[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Random sd* devices numbering (udev)



On 09/03/2007 0:50, Bob McGowan wrote:

Hmm, I thought the LABEL/UUID mounting feature was part of udev??

No, AFAICT it's part of mount, see -L and -U options in man mount.

On the other hand, using udev, you may be able to figure out how to write a naming rule that always names the devices correctly. I've no experience with this and can only with you good luck if you choose this route.

Indeed, in the /sys tree you can find various info related to devices, which can help you uniquely identify them; I prefer this way rather then relying on a label assigned by me, also because it works even for any future partitions I might add on the same disks. After reading some docs I wrote two satisfying udev naming rules, although not what I meant to do initially:

SUBSYSTEM=="block", ATTRS{vendor}=="Areca", SYMLINK+="areca%n"
SUBSYSTEM=="block", ATTRS{vendor}=="Promise", SYMLINK+="promise%n"

Areca is the PCI-X SATA RAID controller, Promise is the external storage unit; the software RAID devices on the builtin ICH7 SATA, where the system is installed, are instead always automagically mounted fine, even if their device sd* names sometimes change at boot, so I left this magic alone. I know these rules could fail if I add more devices from the same vendors, but it's not planned at all :), and anyway could easily be refined later.

So, the two devices are still named sda or sdb in a random way, but I also have some symlinks which always identify them clearly: /dev/areca, /dev/areca1, /dev/promise, /dev/promise1... And I can use these symlinks in fstab and elsewhere.

Actually, I meant to completely change their naming, so my first test rules were:

SUBSYSTEM=="block", ATTRS{vendor}=="Areca", NAME="sde%n", SYMLINK+="areca%n"
SUBSYSTEM=="block", ATTRS{vendor}=="Promise", NAME="sdf%n", SYMLINK+="promise%n"

(just two lines, mind the word wrap)

But what happened was that the devices were assigned the sde/sdf names, were assigned the areca/promise symlinks, but they were ALSO still assigned the original random sda/sdb names. I couldn't find where this assignment came from, I can't see any "sd" assignment in /etc/udev/rules.d/*, so I removed my own names and settled down with my symlinks to the default names. I know there's a last_rule option which might have helped me prevent the double names, but I didn't want to break anything by overriding system naming rules.
Anyway, any info on why this happens is welcome.

--
Ciao,
  Marco.



Reply to: