lkml.org 
[lkml]   [1996]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Any "file" utility for partitions?
On Wed, 27 Mar 1996, Bjorn Ekwall wrote:

> > Played around a bit, and found a relativ simple way to identify all my
> > ext2-partitions:
> [patch deleted]
> > ----------------fs_magic file
> > 0x0438 short 0xef53 ext2-fs
> > ----------------
>
[...]
>
> Nice!
>
> Now we only have to be able to recognize cdroms (iso9660), minix, ext,
> xiafs, nfs ( :-)), hpfs, sysv, fat and vfat (with umsdos)
> and perhaps a few others...
>
Just add them to the magic file...

# magic file to identify filesystems
#--------------------------------------------------------------------------

# minix filesystem
# short (14 char) filenames
0x0410 short 0x137f minix
>0x0412 short 0x0001 (clean)
# long (30 char) filenames
0x0410 short 0x138f minix
>0x0412 short 0x0001 (clean)

# extended filesystem
0x0438 short 0x137d ext

# secound extended filesystem
0x0438 short 0xef53 ext2
>0x043a short 0x0001 (clean)

# xiafs
0x0638 long 0x012fd16d xiafs

# CD-ROM
0x8001 string CD001 iso9660
# high sierra?

# MS-DOS (and umsdos) hmm, the FAT starts with 0xfff8 always (right?)
# not a real good magic, that's why we test it last...
0x0200 short 0xfff8 msdos

(PS: hav'nt tested ext and xiafs)

As you can see, its no problem to check the clean flag (for minix
and ext2) too, this may be intresting for a desaster boot disk.

The fat-family (msdos,umsdos,vfat) is a special case. But if you know it
is a fat fs, you can mount it as msdos and check for a
/linux/--linux-.--- (?) file to find if this can be a umsdos root-fs.

> Finding the set of possible root filesystems can be done by mounting
> and looking for some significant file(s).
> I think /sbin/init and/or /etc/init can be rather good candidates...
>
How about /etc/fstab ? This allows some extra checks :-)

On the other side it is overkill to mount all filesystems just for
checking which of one is the root filesystem (and you can't be sure it
works), at least for every day useage.

It's ok for installing (better updating, else you hav'nt a root-fs) a
linux system or for a generic desaster boot floppy.

Gerd

Gerd Knorr <kraxel@cs.tu-berlin.de> | http://www.cs.tu-berlin.de/~kraxel/



\
 
 \ /
  Last update: 2005-03-22 13:36    [W:0.112 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site