Using udev rules to fix device filename

For example, fix the usb hard disk's first partition to /dev/usbhd.

Get device information

Plug in the device, and look up the sysfs path:

# suppose the device is assigned to /dev/sdc by the kernel:
udevinfo -q path -n sdc

# Output:
/block/sdc

Now, list device details using the device path /block/sdc:

udevinfo -a -p /block/sdc

# output:
  looking at device '/block/sdc':
    KERNEL=="sdc"
    SUBSYSTEM=="block"
...
    BUS=="scsi"
    DRIVER=="sd"
...
    SYSFS{model}=="HDP725032GLA360 "
    SYSFS{vendor}=="Hitachi "
...
    SYSFS{configuration}=="Bulk Only Configuration"
    SYSFS{serial}=="Hitachi HD      GEA330RC0ERABE"
    SYSFS{product}=="BUFFALO INC. USB-SATA Bridge"
    SYSFS{manufacturer}=="BUFFALO INC."
...

Create udev rule for the device

To fix the device's first partition at /dev/usbhd, we use these info:

  • Bus
  • vendor
  • model

Create file in /etc/udev/rules.d/, example: 10-usb-hd.rules:

# 10-usb-hd.rules

BUS=="scsi", SYSFS{vendor}=="Hitachi", SYSFS{model}=="HDP725032GLA360", KERNEL=="sd*1", NAME="%k", SYMLINK="usbhd"
tips/using_udev_rules_to_fix_device_filename.txt · Last modified: 2010-11-15 15:43 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0