From: Brandon S. Allbery (kf8nh@kf8nh.wariat.org)
Date: 01/22/93


From: kf8nh@kf8nh.wariat.org (Brandon S. Allbery)
Subject: Re: a universal set of fs commands?
Date: Fri, 22 Jan 1993 18:52:17 EST

gleasokr@rintintin.Colorado.EDU (Kris Gleason) writes:
> 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

I didn't say it was the only viable way or the only way that should be used.
Just that it shouldn't be ignored outright, just because some OSes have
buggy partition recognizers. Bugs should be fixed, not hacked around by
working software.

> 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

Sort of. I've noticed the Linux msdos fs type will attempt to read random
data as an MS-DOS filesystem, report invalid parameters, and fail. Which
may be the only way to handle MS-DOS; I don't know.

> 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.

Again, I never said it should be the only criterion. I was responding to
folks who said it explicitly should *not* be considered at all.

I plan to use several methods, including (for existing filesystems)
/etc/fstab, partition types, magic numbers where they exist, etc. The
per-fstype executable that checks this has the job of deciding what the
criteria are and doing the check, which allows the use of magic numbers in
"nonstandard" locations, non-magic-number schemes like the msdos filesystem,
etc.

> >(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.

Okay. I like this myself, as long as it's possible to specify a size. Disk
striping is a nice way to put those spare 20MB drives to use that you have
left over from your XT days :-)

> 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.

Again, partition ID is not the only criterion it will use. And in any case
mkfs will be saying something like

  mkfs: partition data for /dev/hda1 suggests minix filesystem of 32766 blocks
  if this is incorrect, interrupt within 10 seconds then use "-t fstype"

(Which also gives you 10 seconds to realize you typed "/dev/hda1" instead of
"/dev/hda2" and stop short of trashing your root partition :-)

I've been thinking about this issue for most of the day, but I need to set
some things down in an organized fashion before I can try to give any real
details. (I think I was a bit over-ambitious in suggesting I'd have a
prototype done this weekend. Besides, this gives me time to get my 330MB
SCSI hard drive in so I'll have room to play with this stuff, not to mention
being able to *test* mkfs after writing it. :-)

++Brandon