2

Is there a way to force an usb drive to always get a specific letter in /dev/sd*? I know about udev symlinks, that does not help.

1
  • i have exactly the same problem. I have a USB3 JBOD with 4 drives in it running zfs. Every time I offline a disk, to hotswap it, it comes back online with a new /dev/sd? device... F*cking annoying. I got a UDEV rule working to use the drive serial numbers to do device symlinks, but it still doesn't play nice with zfs...
    – Brad
    Apr 17, 2017 at 15:06

1 Answer 1

1

You need a custom UDEV rule to set this up. Plug the device in and you can find out the vendorid and productid with ...

lsusb 

this will show several lines that look something like this...

Bus 005 Device 003: ID 04fc:0c25 Sunplus Technology Co., Ltd 

From this you can see that ...

  • Vendorid is 04fc
  • Productid is 0c25

As the device is a storage device we will be writing the rule in 60-persistent-storage.rules. So open this file with your prefered editor (for instance sudo vi /etc/udev/rules.d/60-persistent-storage.rules) and add the following line:

KERNEL=="sd*[0-9]",SYSFS{idVendor}=="04fc",SYSFS{idProduct}=="0c25", SYMLINK+="usbdrive"

This informs udev-manager, that if any storage device with vendorid 04fc and productid 0c25 is plugged into the system to add a symlink in /dev with name usbdrive. I used usbdrive but you can use another name if need be.

From now on you can access this drive with /dev/usbdrive.

I used this Source for the example.

2
  • 2
    As said in the question, symlinking is not what I want to do.
    – Marcus
    Apr 29, 2012 at 16:25
  • udev IS the way to do this but you are welcome to wait for someone else to come up with another method. Doubt it though :)
    – Rinzwind
    Apr 29, 2012 at 16:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .