UUID and devices

Nils Kassube kassube at gmx.net
Fri Feb 6 22:44:22 UTC 2009


Willy Hamra wrote:
> 2009/2/6 Willy Hamra <w.hamra1987 at gmail.com>:
> > i tend to use devices in their /dev/sdxy format more than i use UUIDs
> > since it's a lot simpler to memorize, and for other reasons.
> > but, on many occasions i'd temprarily add another hard drive,
> > temprarily remove one of the hard drives,and this messes up stuff.
> > for example, linux is on /dev/sdb now, if i take out my windows drive
> > (/dev/sda), sdb becomes sda, and this confuses stuff up.
> > so my question, is there anyway i can attach /dev stuff with a
> > certain UUID? let the system know that *this* UUID is *always* called
> > sdb1 for example, can i do such thing?

I think you would need udev rules like it is done for e.g. network cards 
to always get the same interface name for a particular MAC address. But I 
would rather use disk labels if you want to have something to easily 
memorize. You can use labels in your fstab just like devices or UUIDs. 
The advantage is that you don't have to learn how to write your own udev 
rules. See <https://help.ubuntu.com/community/RenameUSBDrive> for a 
description how to use labels. While that page talks about USB drives you 
can use labels for other disks as well.

> a possible answer for my self. the links in /dev/disk, are they
> created after each boot?

Not exactly, they are created after the disk is found. For the kernel all 
disks are removable devices. OTOH, if you are talking about internal 
disks only, then yes, they are created after each boot.

> if so, then i can be sure that links in 
> /dev/disk/by-id ALWAYS point to the correct device, right? if that's
> the case, can one use these links in fstab?

Yes, I think you could use these links in your fstab, but then you might 
as well use UUIDs. After all these links are also not easily momorizable.


Nils




More information about the kubuntu-users mailing list