0

I am trying to set up a udev rule which symlinks /dev/sda to /dev/cm, /dev/sda1 to /dev/cm1 and /dev/sda2 to /dev/cm2. Of course, depending on what else is connected to the computer, instead of sda, the device could turn up as sdb or anything else. So I have this rule:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="0001", GROUP="disk", SYMLINK+="cm"

This rule matches my device and yields the /dev/cm symlink to the correct device node, but not /dev/cm1 or /dev/cm2, even though I can see that /dev/sda1 and /dev/sda2 have turned up. What am I missing?

1 Answer 1

0

Here is one solution:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0a5c", ATTRS{idProduct}=="0001", GROUP="disk", SYMLINK+="cm%n"

See? the symlink name is not cm, but cm%n. Apparently, the %n is the name of the partition. For me, this rule yields the following symlinks:

  • /dev/cm
  • /dev/cm0 (this one points to /dev/sg0, which is apparently the generic SCSI layer)
  • /dev/cm1 (points to the first partition)
  • /dev/cm2 (points to the second partition)

https://wiki.debian.org/udev is where to go to learn some of this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.