Re: Magic Number for New File system

From: Theodore Ts'o
Date: Fri Dec 17 2004 - 21:42:32 EST


On Fri, Dec 17, 2004 at 11:42:48AM +0530, Bhattiprolu, Ravikumar (Ravikumar) wrote:
>
> We are planning to write a new file system for our requirements. Is
> there any standard way to allocate a magic number for this new file
> system? Also how to go about writing the new file system?

There's no standard place to put a magic number, let alone a standard
way to generate a magic number.... that being said, I'd suggest an 8
character field that contains the ascii name of your filesystem plus a
format version number at the beginning of the superblock. The
location of the superblock will vary from filesystem to filesystem,
but most mkfs program will zero the first 4-8k at the beginning and
end of the device in order to prevent false recognition by programs
trying to ID the device looking for magic numbers in various different
locations.

The blkid library, contained in the e2fsprogs distribution, contains a
list of magic number and their locations used by various different
filesystems, if you'd like to take a look at that for some more
information.

- Ted
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/