From: gleasokr@rintintin.Colorado.EDU (Kris Gleason)
Subject: Re: a universal set of fs commands?
Keywords: fs
Organization: University of Colorado, Boulder
Date: Fri, 22 Jan 1993 00:20:27 GMT

kf8nh@kf8nh.wariat.org (Brandon S. Allbery) writes:

>And the partition ID is a valuable clue as to what the correct filesystem
>type is if certain kinds of superblock corruption occur that leave auto-
>detection schemes confused.

Ok... you convinced me (pretty quickly) that the partition table is the one
place that any os should be able to figure out just what type of partition
is there.  However, what type of filesystem is a floppy disk??  I think
that maybe both a magic number check and a partition table check should be
made in determining the fs type.  Of course, you say that msdos has no 
magic number.  This is no problem for mkfs and fsck right now since there
is no such beast for a dos fs (are these in the works somewhere, I wonder?).
But, even without a magic number that the linux kernel uses, I would assume
that it is possible to detect a filesystem as being a msdos fs.  Correct
me if I'm wrong on this.  Also, other filesytem types I have seen spurious
reports on might not be compatible with the Linux magic numbering convention.
At any rate, I don't think that depending on the partition table alone is
safe enough for a fsck command if it is to be automated.


>> One thing I would like to see in mkfs, though, is autodetection of partition
>> size.  If a partition device is selected to be used (as opposed to an image),
>> it seems simple enough to get the number of blocks from the partition table,
>> rather than specifying it as a command line option.

>(1) As long as your're doing this you might as well get and use the
>    partition ID.

>(2) I have a good reason why this shouldn't be done except as a default if
>    they don't specify a size.  It's called disk striping, which I'm putting
>    into my gdisk driver.

I meant for autodetection to be a default that could easily be overridden.
For simple tasks like mkfs'ing a floppy, this would be convenient, especially
with all of the possible formats of floppy disks.

>> Another thing I would like to see is autodetection for the mount command, 
>> rather than specifying a fs type.  The kernel already does this in order to
>> mount the root filesystem.  Why not read in the `magic number' in mount
>> and use that to determine the fs type?

>This only works if the filesystem has a magic number.  How should it
>autodetect "-t msdos"?  (The kernel need not worry about it for the root
>filesystem... I don't think an msdos root filesystem would work too well. :-)

>mount will be able to use the "fsid" scheme I detailed to get autodetection.

I like it.  The only real problems that I see are the problems with the
partition table being incorrect; it might be a good idea to look at this
id with skepticism rathen than as absolute fact when developing code, and
offer a suitable alternate id-check for systems that are not quite right
(maybe an option for fixing in fsck?  or is it bad to touch the partition 
table without a reboot?)  Also, the most work these commands get on my
system is with floppies.  So, whatever scheme is used, I think a system for
detecting floppy fs-types would be important.

Kris