usb hard disk and udev

Marcel Janssen korgull at home.nl
Sun Jul 17 17:32:46 UTC 2005


Hi,

I'm trying to get my USB hard disks mounted always the same way with udev but 
find some trouble making the rules.
I've been reading a bit of the following : 
http://www.reactivated.net/writing_udev_rules.html

And the rule :
BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device", NAME="%k", 
SYMLINK="usbhd%n"

Seems to be what I want, but I don't understand yet how it can make sure that 
my disk always gets the same mount point (I have multiple USB disks from 
different vendors and want them assigned always to the same device)
One thing is the SYSFS{product}. I can't find this description for my device 
so I can't make the correct rule. Or, can I just take the vendor string in 
from the below output instead ?

udevinfo -a -p /sys/block/sdd/sdd1

udevinfo starts with the device the node belongs to and then walks up the
device chain, to print for every device found, all possibly useful attributes
in the udev key format.
Only attributes within one device section may be used together in one rule,
to match the device for which the node will be created.

device '/sys/block/sdd/sdd1' has major:minor 8:49
  looking at class device '/sys/block/sdd/sdd1':
    SUBSYSTEM=="block"
    SYSFS{dev}=="8:49"
    SYSFS{size}=="39070017"
    SYSFS{start}=="63"
    SYSFS{stat}=="    1657     1657        6        6"

follow the "device"-link to the physical device:
  looking at the device chain at 
'/sys/devices/pci0000:00/0000:00:02.1/usb1/1-2/1-2.1/1-2.1:1.0/host22/target22:0:0/22:0:0:0':
    BUS=="scsi"
    ID=="22:0:0:0"
    DRIVER=="sd"
    SYSFS{device_blocked}=="0"
    SYSFS{iocounterbits}=="32"
    SYSFS{iodone_cnt}=="0x623b"
    SYSFS{ioerr_cnt}=="0x1"
    SYSFS{iorequest_cnt}=="0x623b"
    SYSFS{max_sectors}=="256"
    SYSFS{model}=="     HS-HD"
    SYSFS{queue_depth}=="1"
    SYSFS{queue_type}=="none"
    SYSFS{rev}=="2.23"
    SYSFS{scsi_level}=="3"
    SYSFS{state}=="running"
    SYSFS{timeout}=="30"
    SYSFS{type}=="0"
    SYSFS{vendor}=="DCB     "

regards,
Marcel
 




More information about the fedora-list mailing list