Finding the serial number of each drive
A serial number is the only label a technician can match to a physical drive. Here are the quickest ways to read it for every drive type.
Why does the serial number matter?
Because device names are assigned at boot and can change, while the serial is printed on the drive itself. The kernel calls disks sda or nvme1n1 in the order it finds them, which does not have to follow bay positions and can shift when a drive fails or is added. When you ask for a replacement, giving the serial of the faulty drive, plus the serials of the healthy ones, makes sure the right disk comes out.
What is the fastest way to list all serials?
lsblk prints them in one table for every drive the kernel sees. Add the model and size so the output also confirms what you rent.
lsblk -d -o NAME,MODEL,SERIAL,SIZE,ROTA,TRAN
ROTA is 1 for a spinning drive and 0 for an SSD, and TRAN shows sata, sas or nvme. On a Storage machine with 24 drives the list is long; pipe it through sort -k1 to keep it in order.
How do I read it with smartctl?
smartctl talks to the drive directly, so it works even when udev data is incomplete. Install smartmontools, then query each device.
smartctl -i /dev/sdc | grep -iE 'serial|model|capacity'
for dev in /dev/sd[a-z]; do echo "$dev $(smartctl -i $dev | awk '/Serial Number/{print $3}')"; done
For SAS drives the field is called Serial number with a lower-case n; the grep above catches both spellings.
And on NVMe drives?
Use nvme list from the nvme-cli package, which shows serial, model, namespace and capacity for every NVMe device in one go. It is also the quickest way to see firmware versions.
apt install nvme-cli # or: dnf install nvme-cli nvme list nvme id-ctrl /dev/nvme0 | grep -E '^sn|^mn|^fr'
Which drive belongs to which RAID array?
Combine the array view with the serials. mdadm --detail lists member partitions; /dev/disk/by-id links stable names that contain the serial to the current device names. Reading both together shows which physical drive each array relies on.
mdadm --detail /dev/md2 | awk '/active sync|faulty|spare/ {print $NF}'
ls -l /dev/disk/by-id/ | grep -v -e wwn- -e part | awk '{print $9, $11}'
Names in by-id look like nvme-SAMSUNG_MZQL2960HCJR-00A07_S64FNE0R512345, with the serial at the end. They stay the same after a reboot, which also makes them a good choice for /etc/fstab and ZFS pool definitions.
The failed drive has disappeared. How do I find its serial?
List the serials of the drives that are still present; the missing one is whichever serial is absent from that list. If you recorded a baseline at delivery, as First steps with a new server suggests, the gap is obvious. Without a baseline, look at older log entries: the kernel and smartd often name the device with its serial when errors start.
journalctl -k --since "-3 days" | grep -iE 'serial|nvme[0-9]|sd[a-z]:' | head -n 30 grep -h -i serial /var/log/smartd* 2>/dev/null | tail
When the drive answers intermittently, a reboot into rescue mode sometimes brings it back long enough to read the serial; the rescue system includes smartctl.
How should I report serials in a ticket?
As a short list that leaves no room for doubt:
| Device now | Serial | State |
|---|---|---|
| sda | WD-WX12A3456789 | Healthy, keep |
| sdb | (not visible) | Failed, replace |
| sdc | WD-WX12A3456791 | Healthy, keep |
Add the output of cat /proc/mdstat and the SMART lines that show the fault. The Get a failed disk replaced guide covers the rest of the process.
Do SAS drives behind a backplane show serials the same way?
Yes, on our Storage machines the large SAS drives appear to Linux as ordinary sd devices, so lsblk and smartctl read their serials directly. With many drives, lsscsi -g adds the SCSI address of each one, which is handy for matching the order in which the controller presents them. Include that address in a ticket alongside the serial if you have it; it narrows the search on a chassis with two dozen bays.
Can I record serials automatically?
Yes, and it is worth doing on machines with many drives. A small cron job that writes lsblk -d -o NAME,SERIAL,SIZE to a dated file each week gives you a history of which device name held which drive. On large arrays such as the 24 drives of STORAGE-3 2024, this record saves real time on the day a drive fails.
echo '0 6 * * 1 root lsblk -d -o NAME,SERIAL,SIZE > /var/log/disk-serials-$(date +\%F).txt' > /etc/cron.d/disk-serials
Related pages
Get a failed disk replaced
How to confirm a drive is failing, collect the details technicians need, and what happens before and after the new disk goes in.
Read moreReplace a disk in software RAID
The full command sequence to remove a dead member from an mdadm mirror, partition the new drive, rebuild and restore boot on both disks.
Read moreDiagnose hardware problems
Tell a hardware fault from a software one: memory errors, overheating, disk trouble and network faults, checked from the running system or rescue mode.
Read moreNVMe vs SATA SSD vs HDD
Throughput, latency and cost per terabyte of the three drive types in our machines, and which job suits each.
Read moreQuestions and answers
How do I list all disk serial numbers at once?
Run lsblk -d -o NAME,MODEL,SERIAL,SIZE. For NVMe drives, nvme list gives the same in one table.
Why not just tell support the device name, like sdb?
Device names are assigned at boot and do not map reliably to bays. The serial is printed on the drive and identifies it without doubt.
How do I find the serial of a drive that disappeared?
List the serials still present; the missing one is the failed drive. Old kernel or smartd log entries often name it too.
Where are stable disk names kept?
In /dev/disk/by-id. The link names include model and serial and survive reboots.
Does rescue mode have smartctl?
Yes. You can read serial numbers and SMART data from rescue mode if the installed system does not start.