I have four USB thumb drives, which are marked 1-4 but otherwise identical.
How do I get udev to assign them the same /dev/ entries every time it notices them? -- -eben [hidden email] ebmanda.redirectme.net:81 LIBRA: A big promotion is just around the corner for someone much more talented than you. Laughter is the very best medicine, remember that when your appendix bursts next week. -- Weird Al _______________________________________________ slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
You must either use dongles, different makes of drives with different
product ID's (PID) or different VID's (vendor ID's), or use full usb 3.1 devices and ports that are required to have serial numbers...but that is not exactly followed. Try looking for the iSerialNumber field in the USB device descriptor. If there is one, it is supposed to be unique. Other than that, I have no idea. The bit from the udev rules that kicked me away from trying something like this: Matching sysfs attributes The match keys introduced so far only provide limited matching capabilities. Realistically we require much finer control: we want to identify devices based on advanced properties such as vendor codes, exact product numbers, serial numbers, storage capacities, number of partitions, etc. Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the /ATTR/ key with a slightly different syntax. Here is an example rule which matches a single attribute from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes. SUBSYSTEM=="block", ATTR{size}=="234441648", SYMLINK+="my_disk" On 2/2/2016 12:31 PM, Eben King wrote: > I have four USB thumb drives, which are marked 1-4 but otherwise > identical. How do I get udev to assign them the same /dev/ entries > every time it notices them? > _______________________________________________ slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
In reply to this post by Eben King
Have you used udevinfo to list the properties for each? See any
differences at all between them? If so, (unless it is just a disk error rate) then you can use that to write udev rules, right? On 2/2/2016 12:31 PM, Eben King wrote: > I have four USB thumb drives, which are marked 1-4 but otherwise > identical. How do I get udev to assign them the same /dev/ entries > every time it notices them? > _______________________________________________ slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
On Tue, 2 Feb 2016, Art Eaton wrote:
> On 2/2/2016 12:31 PM, Eben King wrote: >> I have four USB thumb drives, which are marked 1-4 but otherwise identical. >> How do I get udev to assign them the same /dev/ entries every time it >> notices them? > Have you used udevinfo to list the properties for each? Don't appear to have it: eben@pc:~$ udevinfo -h udevinfo: command not found eben@pc:~$ locate udevinfo eben@pc:~$ Synaptic doesn't have it, but lsusb -v (as root) gave up the goods: 1: iSerial 3 P16000160703617A05473776 2: iSerial 3 P1600016070361880F9D2F69 3: iSerial 3 P16000160703617A170AB796 4: iSerial 3 P16000160703617A21EC8E37 > you can use that to write udev rules, right? I can figure out how. Probably. -- -eben [hidden email] ebmanda.redirectme.net:81 LIBRA: A big promotion is just around the corner for someone much more talented than you. Laughter is the very best medicine, remember that when your appendix bursts next week. -- Weird Al _______________________________________________ slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
Looks like iSerial came through for you. You are lucky I think.
On 2/2/2016 2:24 PM, Eben King wrote: > On Tue, 2 Feb 2016, Art Eaton wrote: > >> On 2/2/2016 12:31 PM, Eben King wrote: >>> I have four USB thumb drives, which are marked 1-4 but otherwise >>> identical. How do I get udev to assign them the same /dev/ entries >>> every time it notices them? > >> Have you used udevinfo to list the properties for each? > > Don't appear to have it: > > eben@pc:~$ udevinfo -h > udevinfo: command not found > eben@pc:~$ locate udevinfo > eben@pc:~$ > > Synaptic doesn't have it, but lsusb -v (as root) gave up the goods: > > 1: iSerial 3 P16000160703617A05473776 > 2: iSerial 3 P1600016070361880F9D2F69 > 3: iSerial 3 P16000160703617A170AB796 > 4: iSerial 3 P16000160703617A21EC8E37 > >> you can use that to write udev rules, right? > > I can figure out how. Probably. > slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
In reply to this post by Eben King
On Tue, 2 Feb 2016, Eben King wrote:
> Synaptic doesn't have it, but lsusb -v (as root) gave up the goods: > > 1: iSerial 3 P16000160703617A05473776 > 2: iSerial 3 P1600016070361880F9D2F69 > 3: iSerial 3 P16000160703617A170AB796 > 4: iSerial 3 P16000160703617A21EC8E37 > >> you can use that to write udev rules, right? > > I can figure out how. Probably. Yup: ATTRS{serial}=="P16000160703617A05473776",SYMLINK="raid_1" ATTRS{serial}=="P1600016070361880F9D2F69",SYMLINK="raid_2" ATTRS{serial}=="P16000160703617A170AB796",SYMLINK="raid_3" ATTRS{serial}=="P16000160703617A21EC8E37",SYMLINK="raid_4" If something else pops up with one of those serials it breaks the RAID, but it's highly unlikely that'll happen. Odd that it wants ATTRS{serial} and not ATTRS{iSerial}, but I guess it's going for the (unstated) logical name instead. -- -eben [hidden email] ebmanda.redirectme.net:81 LIBRA: A big promotion is just around the corner for someone much more talented than you. Laughter is the very best medicine, remember that when your appendix bursts next week. -- Weird Al _______________________________________________ slug mailing list [hidden email] https://www.suncoastlug.org/mailman/listinfo/slug |
Free forum by Nabble | Edit this page |