You are not logged in.

#1 2016-12-23 20:54:10

nesk
Member
Registered: 2011-03-31
Posts: 187

[solved] udev static device name not working for USB drive

I'm following Wiki: https://wiki.archlinux.org/index.php/Ud … ash_device
My goal is to have this USB drive plugged in at all times and have it named /dev/sdh on boot. I created an udev rule, but it's not working:

[root@arch media]# lsusb -v 2>/dev/null| grep -A 5 SimpleTech
Bus 003 Device 005: ID 4971:8017 SimpleTech 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
--
  idVendor           0x4971 SimpleTech
  idProduct          0x8017 
  bcdDevice           81.04
  iManufacturer           1 JMicron
  iProduct                2 USB to ATA/ATAPI Bridge
  iSerial                 3 111122223333
[root@arch media]# cat /etc/udev/rules.d/11-usb-drive-465gb.rules
KERNEL=="sd*", ATTRS{idVendor}=="0x4971", ATTRS{idProduct}=="0x8017" SYMLINK+="sdh%n"
[root@arch media]# udevadm trigger
[root@arch media]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2	/dev/sda3  /dev/sda4  /dev/sda5  /dev/sda6  /dev/sda7  /dev/sdb  /dev/sdb1  /dev/sdc  /dev/sdc1

So it gets assigned as /dev/sdc. I tried unplugging and plugging it too, it's still /dev/sdc. Am I doing something wrong?

P.S. I think this post belongs in System Administration section, but I can't post there. If mods are reading this - pls move it there.

UPDATE: solved by using information from "udevadm info --name=/dev/sdc1 --attribute-walk" instead of "lsusb", as it produces IDs more readily suitable to use in udev rules. Updated Wiki article with this.

Last edited by nesk (2016-12-26 16:38:52)

Offline

Board footer

Powered by FluxBB