Compare:
root@home:~# hdparm -I /dev/sdb | grep Serial
Serial Number: WCJ025C8
Transport: Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
root@home:~#
to:
root@home:~# udevadm info -a -p $(udevadm info -q path -n /dev/sdb) | grep -i serial
ATTRS{serial}=="0123456789ABCDEF"
ATTRS{serial}=="0000:00:14.0"
root@home:~#
I see this 0123456789ABCDEF
a lot with udev, but it's bogus, whereas hdparm
's output exactly matches the physical number on the drive.
As a result, I can't create udev rules that'll match my 4 USB drives by serial number.
I'm running ubuntu 16.04 LTE.
Suggestions greatly appreciated.
Best Answer
In the end I went with this, which is a bit of a hack:
and then a quick script like this:
It ain't pretty, but it works...