LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   udev doesn't update the links to scsi disks properly. (http://www.linuxquestions.org/questions/linux-newbie-8/udev-doesn%27t-update-the-links-to-scsi-disks-properly-696289/)

kshitij_dixit 01-10-2009 06:51 AM

udev doesn't update the links to scsi disks properly.
 
Hi All,

udev doesn't update the links to scsi disks properly after removing and
reinserting a disk, which means that disks can't be accessed automatically by using the same name.

However after removing one disk physically and reinserting it we have the links below, note that kernel name changes but it shouldn't be a problem with udev, but it's not working and doesn't create the link for /dev/sdc.

lrwxrwxrwx 1 root root 33 Jan 9 12:40 /dev/sdb ->
scsi/host0/bus0/target2/lun0/disc
lrwxrwxrwx 1 root root 34 Jan 9 12:40 /dev/sdb1 ->
scsi/host0/bus0/target2/lun0/part1
lrwxrwxrwx 1 root root 34 Jan 9 12:40 /dev/sdb2 ->
scsi/host0/bus0/target2/lun0/part2
brw-rw---- 1 root disk 8, 32 Jan 9 12:47 /dev/sdc
lrwxrwxrwx 1 root root 34 Jan 9 12:47 /dev/sdc1 ->
scsi/host0/bus0/target1/lun0/part1
lrwxrwxrwx 1 root root 34 Jan 9 12:47 /dev/sdc2 ->
scsi/host0/bus0/target1/lun0/part2

After some investigation I found that udev rule for sdc
doesn't match any of the rules in devfs.rules and related script never run.However partitions on the disks match and works fine.
rules for:-

/dev/sd[a-z] and /dev/sd[a-z][0-9]*
BUS="scsi", KERNEL="sd[a-z]",
PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}",
SYMLINK+="%k %c{2}"
BUS="scsi", KERNEL="sd[a-z][0-9]*",
PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}",
SYMLINK+="%k %c{2}"

First rule doesn't match when the disk is inserted. Interestingly, when the udev is restarted it works.Kernel reports the device name correctly but there is a problem with the BUS name. It works with partitions but not with the main disk. Assuming that we'll only have sd[a-z] names from scsi bus I removed the BUS="scsi" rule from the first rule and it's working flawlessly. i am not sure is removing BUS option right method or not? could any one please help me in solveing this issue.

Thanks

kshitij_dixit 01-13-2009 07:26 AM

can any one plese help me in that as i dont know much about udev.

tredegar 01-13-2009 08:34 AM

I am not sure from your post if "it's working flawlessly", or there is still some sort of problem.
Anyway, this link http://www.reactivated.net/writing_udev_rules.html might help you understand the udev rule(s).


All times are GMT -5. The time now is 10:47 AM.