This question already has an answer here:
- Harddisk serial number from terminal? 8 answers
WWN = world wide name
Seagate Constellation ES, model ST3500514NS, a 500 GB 3.5" SATA drive
It has "serial number", 9WJxxxxx which is eight characters. It has WWN 5000C5002E47xxxx which is a 16 characters. Both are printed on the label on the hard disk drive.
WD model WD4001FFSX, a 4 TB SATA drive
It has "serial number" WMC5D0Dxxxxx which is 12 characters. It has WWN 50014EE003Fxxxxx which is 16 characters.
HGST, model HUC109060CSS600, a 300 GB 2.5" SAS drive
It has "serial number" KWJTxxx, also eight characters. It has WWN... I don't know; it is not printed on the label and not plugged into the system to find out.
For inventory, we generally write down and track the following, which can always be gathered from the label on the drive:
- Model number
- Serial number
- Size in GB or TB, and connection type which is either SATA or SAS
- Location where in use, or in storage when not in use
The problem arises obviously 1, 2, 3 years later when an inventory sheet shows whatever hard drive. You are pretty sure it's in a running server, but you don't want to shut down the server to pull the hard drive to read the label.
How do you get the serial number of the drive that corresponds to what is on the label?
udevadm info --query=all --name=/dev/sda has ID_SERIAL, but that is the WWN. We don't want another field to track the 16 characters of the WWN as an identifier... And I already hate writing down the long serial numbers of WD drives.
Is there a way in Linux to extract the serial number of the drive?
I believe it is possible because years ago the RAID storage manager GUI we had been using nicely reported the eight-character serial numbers of Seagate drives that were in use. And that RAID hardware has listed a bunch of Seagate-specific hard disk drives that were "officially supported", and if memory serves, really no other make/model of drives.
Is it possible this is hard disk drive firmware related, meaning it can be done on certain make drives and not others?