Skip to content

Creating a custom device node for specific hardware with udev

Sometimes you want specific hardware to get a specific device name in /dev. For example, I want my backup hard disk to have the same device name. I can’t automate anything if sometimes the device is sdc and other times it’s sdd.

To do that, you need to create a specific udev rule. I put this one in 10-local for my backup hard disk:

BUS=="scsi", KERNEL=="sd*", SYSFS{vendor}=="ST325062", NAME="usbhd%n"

Everything with dual equal sign it uses as match, and I assign a different name at the end with a single equals sign.

You can look up the specific attributes to match in “/sys/bus/scsi/devices/[devicenumber]/”. The file “vendor” contains the “ST325062” I match for. My internal drives have vendor ATA (for whatever reason), so there will never be a conflict.

After having made the rule, you can use “udevstart”, “udevtrigger”, “udevadm trigger” or whatever your distro uses to test it.

Edit, this has been deprecated. Now it’s:

SUBSYSTEM=="scsi", KERNEL=="sd*", ATTR{vendor}=="ST325062", NAME="usbhd%n"

    1 Comment ( Add comment / trackback )

    1. (permalink) Trackback from sprawdzony terapeuta
      On Nov 24, 2014 at 05:28

      sprawdzony terapeuta

      blog topic