Messages in this thread | | | From | (Bjorn Ekwall) | Subject | Re: Any "file" utility for partitions? | Date | Wed, 27 Mar 1996 23:09:34 +0100 (MET) |
| |
Gerd Knorr <kraxel@cs.tu-berlin.de> wrote: > On Tue, 26 Mar 1996, Bjorn Ekwall wrote: > > For now one can recognize a (Linux) swap-partition by looking for > > the swap signature as well as identify quite a few other types > > by looking for the (respective) s_magic fields in the super blocks. > > > > So, has anyone created such a tool (yet)? Any takers? > > > 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 > ---------------- > > and now this: > > felix root ~# fdisk -l 2>/dev/null | awk '/^\/dev/ { print $1 }' | > > xargs /usr/src/system/file-3.15/file -m fs_magic > /dev/sda1: block special (8/1) data > /dev/sdb1: block special (8/17) ext2-fs > /dev/sdb2: block special (8/18) data > /dev/sdb3: block special (8/19) data > /dev/sdb5: block special (8/21) ext2-fs > /dev/sdb6: block special (8/22) ext2-fs > /dev/sdb7: block special (8/23) ext2-fs > /dev/sdb8: block special (8/24) ext2-fs > > should be easy to add other filesystems too. Now we have the next > problem: which of them is the root-filesystem? Mount them all and look for > a characteristic file (maybe /proc directory?) ?
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...
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...
Well, as I usually say: If this was easy, we would have done it already :-)
Any linux-autoconfig people out there?
Bjorn
| |