brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: udevadm info reads the serial number of a disk without opening the case

Disk
~/tips/tip-disk-udevadm-serial-of-a-disk

udevadm info --query=property --name=/dev/sda | grep -E 'ID_MODEL=|ID_SERIAL_SHORT='

Prints model and serial number of a drive from the udev database so you can identify it.

When a disk has to be replaced I want to be sure I pull the right one. The serial number on the label is the proof.

udevadm info --query=property --name=/dev/sda | grep -E 'ID_MODEL=|ID_SERIAL_SHORT='

udevadm info prints the properties udev collected for a device. ID_SERIAL_SHORT is the serial printed on the drive label, so you can match it with the sticker before you unplug anything. The same data is behind the stable names in /dev/disk/by-id/. Some USB enclosures report the serial of the bridge chip instead of the drive.

Further reading: udevadm manual page

More Disk tips sudo e2freefrag /dev/sdb1 sudo smartctl -a --json /dev/sda | jq '.smart_status.passed' lsscsi -s udisksctl power-off -b /dev/sdX du -sh — .[!.]* * 2>/dev/null | sort -h All Disk tips (44) All topics

Link