Linux: How to Find a Hard Drive Serial Number

Like many other times I had to retrieve the serial number of a faulty SATA drive on a Linux box. You should retrieve and compare the serial number before replacing to reduce the chance of replacing a working drive instead of a faulty drive. Hdparm is a utility that allows for the retrieval of the serial number, if I remember correctly hdparm is included by default on Ubuntu, Scientific Linux users can install hdparm from the repositories by using yum install hdparm.

Note: hdparm requires access to the root account or similar.

Retrieve The Info

The hdparm output will be rather long, but all you need to look for is Serial Number: xx-xxxxxxxxx, this is where the serial number for the drive is contained.

# hdparm -I /dev/sdf


ATA device, with non-removable media
	Model Number:       WDC WD5001AALS-00L3B2
	Serial Number:      WD-WMASZ0044725
	Firmware Revision:  01.03B01
	Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5
	Supported: 8 7 6 5
	Likely used: 8

Now you can physically verify whether the drive label matches the serial number you just obtained with the help of hdparm. Check twice you wouldn’t want to pull a working drive instead.