Today I was connecting a second USB harddrive to my NSLU2.

What you get is a few interesting effects, among them device IDs (/dev/sda, sdb...) changing depending on the order in which you attach the drives. Plus, I added a USB hub, which makes the device names change anyway.

udev plus tux, from the udev pageThe solution for the crazily jumping dev nodes is the udev system, which is part of Linux for quite a while now, but I never really had a need to play with it yet. But the howto is pretty nice and easy to apply.

Still, a few notes:

  • The SYSFS{whatever} rules support wildcards, so that you don't have to write the whole descriptor if you don't want to. For example, "Max*" instead of "Maxtor 6" works totally fine. -- That's especially useful since SYSFS{model} descriptors often seem to be filled up with a couple of spaces at the end.
  • Some (all?) USB hard drives in fact don't consider themselves to be USB devices. So in this case defining BUS=="usb" will not result in any device links to be created at all. I had to define BUS=="scsi" instead. You should look at the udevinfo output as suggested in the "writing udev rules" howto, it will tell you exactly what setup is necessary for your device/drive configuration.

That's how my two new rules look like (each in one line only): BUS=="scsi", KERNEL=="sd", SYSFS{vendor}=="Maxtor", SYSFS{model}=="L250R0", NAME="%k", SYMLINK="usbhd/maxtor250%n" BUS=="scsi", KERNEL=="sd", SYSFS{vendor}=="Maxtor", SYSFS{model}=="Y080P0", NAME="%k", SYMLINK="usbhd/maxtor80%n"

If you have any questions, let me know.

If not, have fun :)

Was this helpful? Buy me a coffee with Bitcoin! (What is this?)

SQlite error: Unable to Open Database File

When writing a web app using an SQLite database file, you might run into an error where you can read from the file but not write to it......… Continue reading

Micro-tipping with Bitcoin

Published on November 27, 2014

setTimeout in Python

Published on November 14, 2014