[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [debian-knoppix] Recognizing SWAP partitions (incorrectly) and loop inputs



     (resend using proper email address)
Klaus Knopper wrote:
On Thu, Sep 30, 2004 at 08:29:50PM -0700, Stephen Samuel wrote:

Klaus Knopper wrote:

Hello Stephen,

On Mon, Sep 27, 2004 at 03:52:34PM -0700, Stephen Samuel (leave the email alone) wrote:


I ran into a situation this weekend where I had a disk which
had ONCE been formatted as a Linux SWAP partition and then later
as a BSD filesystem... IT turns out that the bsd newfs program
does NOT stomp on the Linux swap magic string, meaning that when
knoppix booted, it used the new BSD filesystem as a swap partition.
Since the machine in question is low on memory, the swap was
quickly ued, and the filesystem trashed.

That's bad, but I would rather say it's a definitive bug of the bsd newfs
program not to clear a swap signature when creating a file system header!

No. The design of newfs is to NOT delete stuff at the beginning of the partition,
because sometimes other programs (eg. boot loaders ) use it.


That's something entirely different. If you reformat a partition, the header
should be cleared. What good is a boot record on a partition when the content
is gone?
Depends on the boot software.  LILO needs to know exactly where it's second
stage is, while GRUB can go rooting (grubbing?) around for the filenames
in the filesystem proper. It might actually be possible, with grub, to replace
a Linux system with a BSD system and still have grub work properly.



-- and since various filesystems have their signatures at various places (eg: Reiserfs is at 64K), if you took that responsibility, you'd essentially have to zero the entire partition
(or at least the first megabyte).

But mkreiserfs clears the swap signature.
This makes sense with Mkreiserfs, since reiserfs actually works with Linux,
and it's <b>entirely</b> reasonable to expect that someone testing on a system
is going to mkreiserfs on an old swap partition without bothering to change
the partition type...  (i.e.. Reiserfs must be able to survive on top of
an old Linux swap partiton that is still tagged as such).

On the other hand, when a BSD system marks a partition as BSD, It's
part of the 'signature'. It SHOULD say to other systems 'Hands off
unless you *REALLY* know what you're doing here.

Forcing users to explicitly say when they want to use a swap partition
that is marked as belonging to another OS is consistent with that.

Part of the problem with swap partitions is that the swap system doesn't
have enough organization to be able to recognixe when a swap partition has
been re-provisioned just by the contents of the partition -- and can do so
much damage so quickly.

Knoppix seems to pride itself on not damaging the hard disks that it's
booted on. That's why (I presume) it doesn't mount the filesystems that
it recognizes. That's part of the reason why I booted it on top of my
newly installed BSD box -- because I 'knew' that it was safe.

oops.

Having knoppix only recognize a swap partition if the partition belongs to
Linux (my check accepts *any* linux partition type, I think) will still
recognize the 98% of systems where users use normal tools to prepare
a partition. For the other 2% who know enough to be able to put things
in rotten places, they should also know how to deal with that illegality.

(btw: My patch also prints a message that it's ignoring an apparent swap
signature becuase it's in the wrong partition type)


I originally reported this as a bug to the OpenBSD people (I thought that the
two partition type numbers were the same.. I was wrong).


I, too, think that it is a bug in newfs. Could it be that the BSD people are
just wanting their newfs to be different?

Regards
-Klaus Knopper


------------------------------------------------------------------------

This is the debian-knoppix mailinglist at linuxtag.org. Please use www.linuxtag.org/wws/lists to maintain your account information.


--
Stephen Samuel +1(604)876-0426             samnospam@bcgreen.com
		   http://www.bcgreen.com/
   Powerful committed communication. Transformation touching
     the jewel within each person and bringing it to light.


Reply to: