On Mon, Feb 17, 2003 at 05:49:26PM +0200, Muli Ben-Yehuda wrote:
> On Mon, Feb 17, 2003 at 05:48:07PM +0200, Nadav Har'El wrote:
> 
> > Note, by the way, that newer distributions (such as Redhat 8) use Grub,
> > not LILO, so anything relying on the structure of a lilo boot record
> > isn't foolproof either.
> 
> I never investigated this, so take it with a grain of salt, but I
> believe that the boot record structure is standardized and even *gasp*
> documented. 

Actually, the opposite is true; in all native linux file systems,
the first block (which is reserved for a boot record) is completely
unused. Sorry for replying to 2 messages at once, but this is also
in reply to a message of Arik Baratz: make a simple test:
make some file
# dd if=/dev/zero of=test1 bs=100k count=1
create a DOS filesystem on it (which does use the boot record as a
superblock)
# mkdosfs test1
Then create on it an ext2 file system
# mke2fs test1
(reply 'y' to 'test1 is not a block special device. Proceed anyway?')
then try to loopback mount it
# mkdir test1.d
# mount -o loop test1 test1.d
Then check how it was mounted
# mount | grep test1.d
and you'll see that it was (wrongly!) recognized and mounted as FAT
(probably vfat). Also file(1) will say it's FAT. However,
# mount -o loop -t ext2 test1 test1.d
will also work! I did not go deeply into the layouts of both, but there
is clearly no collision with empty FSes (at least in the sizes I tried).
In practice, it happened to me quite many times that a used FAT
partition was mke2fsed, used (as ext2), and then mounted as FAT without
any errors, by both Linux and Windows, and in almost all cases it looked
empty as FAT. I can also say a very similar scenario is possible with
NTFS reformatted as ext2.

Conclusions:
1. You can't guess the type of a filesystem by looking at its beginning.
You have to try to mount it, and in some cases, think quite a lot before
deciding.
2. If you intend to reformat a used FAT partition as ext2, make sure you
manually empty the first block (e.g. with dd), or you risk having Windows
try to do bad things to it when mounting/checking it (unless it won't
ever see windows again and you mount it only from fstab where you write
its type manually).

> 
> =================================================================
> To unsubscribe, send mail to [EMAIL PROTECTED] with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail [EMAIL PROTECTED]

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to