LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   udev upgrade (https://www.linuxquestions.org/questions/slackware-14/udev-upgrade-716347/)

titopoquito 04-02-2009 10:18 AM

udev and symlink rules with two identical hard disks (was: udev upgrade)
 
If I want to upgrade udev (I have problems with two new hard disks and udev getting confused by my rules that I have added for them) - is/are there any package/s that I have to upgrade as well? - this would be on Slackware 12.2 with the stock kernel

And is there a bigger problem I might get with an upgrading udev than that my system doesn't boot properly?

Any input is welcome :)

titopoquito 04-02-2009 02:01 PM

To answer it myself: AFAIK the upgrade did not do any harm, booted without a problem. The underlying problem persists though, so reverting back to udev-135 from udev-140 ...

rworkman 04-02-2009 02:51 PM

What problem are you seeing?

titopoquito 04-02-2009 03:32 PM

Hi Robby!

I'll try to be not too redundant:

SATA disks in my system:
sda with sda1, sda2 and sda3 (Samsung SATA disk)
sdb with sdb1 the one and only partition (WD SATA disk)
sdc with sdc1 as one and only partiton (WD SATA disk, same model as sdb)

These device names are given properly if I let udev do it's thing and both sdb and sdc are plugged in when I boot. But sdb and sdc are installed in mobile racks with a seperate power switch each - so depending on which of them are powered on at startup the device names of sdb and sdc might change.

I tried to create udev rules to assign symlinks to both sdb and sdc according to their serial numbers. It didn't work at all :( . Funny thing is, if I boot without my home-made rules, "udevadm info --query=all --path=/sys/block/sd{a,b,c}" shows all information right, that means different models and/or different serial numbers for all three SATA drives. If I boot with my rules the device names (sd{a,b,c}) are ok, but udev totally messes up the symlinks. This lead to the following (from memory):

Code:

symlink  linked to  device
/dev/hugin  -->    /dev/sdc
/dev/hugin1  -->    /dev/sdc1
/dev/hugin2  -->    /dev/sda2
/dev/hugin3  -->    /dev/sda3

sdb wasn't assigned, I guess it was overwritten by sdc. Some race condition I guess. Furthermore the udevadm command got different usb numbers, but the same output for all three SATA disks, so same model and serial number for all of them. Not quite right ...


I am not sure if I'm "allowed" to use "ENV" parts in udev rules which is what I did. It's seen in all kind of tutorials. I used it because "udevadm info --attribute-walk ..." alone didn't give any information that is unique for sdb and sdc. Funnily there *is* a unique line for each, i. e. the symlink that udev creates in /dev/disk/by-id/. These are generated from the serial number of the drive, but udevadm --atribute-walk nevertheless doesn't show them as usable.

So if I do nothing, udevadm shows the serial numbers and info right, if I use an udev rule with the serial numbers udev seems to "forget" the serial numbers.

Example of one of the two rules I used, the other one differs only in serial and device name of course:

Code:

KERNEL=="sd*", ENV{ID_SERIAL}="SATA_WDC_WD6400AAKS-_WD-WCASY3969084", NAME="%k", SYMLINK+="munin%n"
For now I have created partitions of different size on both sdb and sdc, so the following rule works. It's a rather ugly workaround IMHO:

Code:

KERNEL=="sd?1", ATTR{size}=="1250242497", SYMLINK+="munin"
If you have any question or comment, feel free to ask/write :)

titopoquito 04-02-2009 03:48 PM

Ok, hit me, I think I messed it up.

Code:

ENV{ID_SERIAL}=
should be

Code:

ENV{ID_SERIAL}==
with a double "==". No wonder it didn't work, frakking typo :(

rworkman 04-02-2009 09:56 PM

Yep, that would do it :-)
I'm curious as to why you don't just use the persistent symlinks that udev provides natively -- see /dev/disk/by-uuid/

titopoquito 04-03-2009 03:56 AM

Oh man, two days the typo was sitting right before my eyes :rolleyes:

Why I don't use the /dev/disk/by-uuid links - hm, I don't remember it very clear. AFAIR I had problems with FAT drives in the past not getting a proper symlink. Maybe it is even a remainder of fiddling with grub and UUID, or ... - I don't remember exactly, caught me. These days I could at least go with /dev/disk/by-id or even with by-uuid I guess.

BTW, I might also reconsider my desire to give my hard disks names ;)


All times are GMT -5. The time now is 04:43 AM.