missing serial / scsi / disk by-id

missing serial / scsi / disk by-id

  • Written by
    Walter Doekes
  • Published on

When you have a lot of storage devices, it's best practice to assign them to raid arrays or ZFS pools by something identifiable. And preferably something that's also readable when outside a computer. Commonly: the disk manufacturer and the serial number.

Usually, both the disk manufacturer and the disk serial number are printed on a small label on the disk. So, if you're in the data center replacing a disk, one glance is sufficient to know you got the correct disk.

For this reason, our ZFS storage pool configurations look like this:

  NAME                                  STATE
  tank                                  ONLINE
    raidz2-0                            ONLINE
      scsi-SSEAGATE_ST10000NM0226_6351  ONLINE
      scsi-SSEAGATE_ST10000NM0226_0226  ONLINE
      scsi-SSEAGATE_ST10000NM0226_8412  ONLINE
      scsi-SSEAGATE_ST10000NM0226_...   ONLINE

Instead of this:

  NAME        STATE
  tank        ONLINE
    raidz2-0  ONLINE
      sda     ONLINE
      sdb     ONLINE
      sdc     ONLINE
      sd...   ONLINE

If you're replacing a faulty disk, you can match it to the serial number and confirm that you haven't done anything stupid.

Referencing these disks is as easy as using the symlink in /dev/disk/by-id.

No model names and serial numbers in udev?

But I don't have any serial numbers in /dev/disk/by-id, I only have these wwn- numbers.

If your /dev/disk/by-id looks like this:

# ls -1 /dev/disk/by-id/
scsi-35000c5001111138e
scsi-35000c50011111401
...
wwn-0x5000c5001111138e
wwn-0x5000c5001111140f
...

And it has no manufacturer/serial symlinks, then udev is letting you down.

Looking at udevadm info /dev/sda may reveal that you're missing some udev rules. On this particular machine I did have ID_SCSI_SERIAL, but not SCSI_VENDOR, SCSI_MODEL or SCSI_IDENT_SERIAL.

On Ubuntu/Focal, the fix was to install sg3-utils-udev which provides udev rules in 55-scsi-sg3_id.rules and 58-scsi-sg3_symlink.rules:

# apt-get install sg3-utils-udev
# udevadm trigger --action=change
# ls -1 /dev/disk/by-id/
scsi-35000c5001111138e
scsi-35000c50011111401
...
scsi-SSEAGATE_ST10000NM0226_8327
scsi-SSEAGATE_ST10000NM0226_916D
...
wwn-0x5000c5001111138e
wwn-0x5000c5001111140f
...

Awesome. Devices with serial numbers. I'm off to create a nice zpool.


Back to overview Newer post: enable noisy build / opensips Older post: smtp_domain / gitlab configuration