Re: no need for a devfs

Scott Laird (laird@pacificrim.net)
Mon, 12 Jan 1998 10:44:48 -0800


In message <6lcd3noHw-B@khms.westfalen.de>, Kai Henningsen writes:
>
>What you probably really want is something like this:
>
>* for each partition, determine a unique id somehow (ext2 already has
> this, and so does FAT)
>
>* Use this id to identify the partition

>And it works for every disk type, not only SCSI disks.
>
>You could have the kernel advertize these names in /proc/disks/ or
>something similar.

You don't really need kernel support for this; as long as you can find
your root filesystem, it's trivial to produce a set of symlinks to the
right devices. Here's a 2-minute perl script that creates
/dev/e2fs/UUID entries for all ext2 filesystems on the system (or at
least all on /dev/sd* or /dev/ha*). It's not great perl, but it
works.

#!/usr/bin/perl -w

@drives=`ls /dev/sd* /dev/hd*`;

foreach $drive (@drives) {
chomp($drive);
open(DUMPE2FS,"/sbin/dumpe2fs $drive 2>&1 |") or next;
while (<DUMPE2FS>) {
if(/Filesystem UUID:\W+([-0-9a-f]+)/) {
print "Drive: $drive ID: $1\n";
symlink("$drive","/dev/ext2/$1");
}
}
}

Scott