S5 file system magic number (was (Re: Pixel/80 trashed fs)

Guy Harris guy%gorodish at Sun.COM
Mon Dec 29 17:12:56 AEST 1986


> ...but I noted later that sVr2 has a magic number in the superblock.
> ...My question:  if there is a magic number there, why doesn't mount() look
> for it and reject file systems with bad magic numbers?

Because the magic number wasn't in the original V7 file system, used until
S5.  S5 added a magic number to the V7 superblock, but only to distinguish
512-byte-block file systems from 1024-byte-block file systems.  Since the
original V7 file system used 512-byte blocks, any file system with an
unknown magic number was treated as a 512-byte-block file system.
Requiring a valid magic number would have required that the root file
system be fixed before an S5 kernel was booted on it, unless the initial
mount of the root file system was treated as a special case, and required
that a file system be fixed before it was mounted by that kernel, unless a
special option were added to the "mount" system call.  I figure they just
decided this was too much trouble.



More information about the Comp.unix.questions mailing list