UUIDs on drives

Florian Diesch diesch at spamfence.net
Sat Aug 16 09:51:07 UTC 2008


ghe <ghe at slsware.com> wrote:

> In my case, with Ubuntu dual booting on the Mac Pro,, udev apparently 
> scanned the SCSI bus before the SATA ports, while the ROM code (Mac EFI) 
> scanned the SATA ports before the SCSI bus. So the names they made up 
> didn't match if the SCSI bus had an active device on it.
>
> (hd0) was always the same because it was determined by the ROM code, but 
> sda wasn't, so when (hd0) was hit to boot, it found and ran grub just 
> fine. But grub couldn't find a kernel to load. I know that's what UUIDs 
> are for, but something didn't work (maybe Ubuntu started using them in 
> the update that broke my install???).
>
> There are "udev rules" that could maintain consistency with all this, 
> but the installer would have to write some, if a given disk is always to 
> have the same label.

udev creates /dev/disk/*, maybe /dev/disk/by-id/ is what you are
looking for


> And, as has been pointed out, the installer doesn't do that. It could, 
> though. If creating fstab is part of its job, why shouldn't writing a 
> few udev rules be, too?

What kind of rules are you missing here?

> UUIDs are yet another layer of software designed to maintain 
> consistency, but they refer only to filesystems, not hardware
> devices. 

And you are mounting filesystems, not hardware devices.


> So some things are still at the mercy of the (sometimes not very 
> merciful and often easily bewildered) ROM code.

Linux doesn't care much about your BIOS. It's just the boot loader
that needs the BIOS.

> The idea of running all block I/O through one piece of code is a great 
> idea, but the operations have to be split out for the protocols of the 
> different controllers, so there's not much to gain, I claim, by labeling 
> all block devices with the same code.

As they all speak something like SCSI or ATAPI (which basically is a
subset of SCSI) it saves you from implementing the same thing in
various different places like they did before.


> udev's purpose of getting rid of redundant nodes in /dev and allowing 
> for new ones for hardware that didn't exist in the past was a good idea, 
> too. I just think there was just a tiny oops in the implementation, 
> around the names used by that one piece of code for the block devices.

udev doesn't implement a naming scheme  but allows you to implement
whatever naming scheme you want.



> Since the node names in /dev are just strings, C's going to be referring 
> to them with pointers anyway, so what's the disadvantage of calling 
> things what they are: SCSIa, SATAa, SASa, IDEa, ATAPIa, FIREWIREa, 
> IEEEa, USB_STICKa, PICTURE_FRAMEa, etc? And leaving enough room in the 
> namespace for all the devices without overlap? (Don't create the nodes, 
> just leave room for them.)
>
> Except for the obvious problems that might be caused legacy software 
> still referring to the sda names. That would need to be fixed, but 
> building a sane map from the sda names to the new ones could 'trivially' 
> be handled by more udev rules...

It's just done the other way around: udev creates various symlinks to
the sds* devices.

If I don't like /dev/sdb1, I have
 /dev/disk/by-label/home
 /dev/disk/by-uuid/20269b52-6c69-47da-9954-dc6954d9638d
 /dev/disk/by-id/ata-SAMSUNG_HM160JC_S0CMJQSP300022-part1
 /dev/disk/by-id/scsi-1ATA_SAMSUNG_HM160JC_S0CMJQSP300022-part1
 /dev/disk/by-path/pci-0000:00:1f.1-scsi-1:0:0:0-part1
to choose from.


> But UUID on top of udev on top of the kernel on top of the BIOS on top 
> of the CPU's I/O... There's got to be an easier way to get to an I/O port.

The kernel doesn't use the BIOS but accesses your hardware through
its drivers. And udev is just an interface for programs to be
executed on kernel events. The device nodes it creates are real
device nodes just like the ones you may have created using mknod in
the good old days.
/etc/fstab is just a file evaluated by mount, and the UUID expressions
are just a shorthand for /dev/disk/by-uuid/$UUID.

Everything is still like it used to be, you're just using different
strings to name things. Or you don't if you don't like to. It's up
to you.

If you think there should be another naming scheme write udev rules to
create the needed devices, publish them on a web page and convince
people that they are the better ones. Or just use them yourself.

It's one of the big advantages of FOSS that you don't need to wait for
the author but can change things yourself.



   Florian
-- 
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
-----------------------------------------------------------------------




More information about the ubuntu-users mailing list