How to Find Out Failed Disks’ SATA Ports in Linux

The Linux disk names (e.g. sda1, hdb3, etc.) are not reliable—they may be changed if there are hardware changes, such an adding or removing a disk. Additionally, the order for the Linux device names is not always the same as the order of SATA poets. For example, the disk connected to SATA port 0 (first port) is not always sda.

It is possibly that you are in a situation like this:

I find one disk failed on my server which have several ones installed. I know the disk’s name in Linux (e.g. sda, sdb). However, the Linux disk name to SATA port mapping does not follow the same order. Now, I want to find out the failed disks. How to quickly find out them and which SATA port are these failed disks connected to?

Map the Linux disk names to serial numbers

Fortunately, there are other names/IDs that we can make use of to identify a failed disk in Linux. The device serial ID is unique for all disks and we can find out the failed disks by their serial numbers.

On Linux, to find a disk’s serial number, we can run this command.

# hdparm -i /dev/sdb | grep Serial

Here, we use sdb as the example.

One example output is like this:

Model=ST31000528AS, FwRev=CC38, SerialNo=5VP5DYYY

(the last 3 digits are anonymized).

If hdparm is not installed, you need to first install it:

# yum install hdparm

By this method, we can easily map the Linux disk names to serial numbers.

Find the failed disks by their serial numbers

After opening the server box, we can easily find out the failed disks according to their serial numbers. The manufacturers usually print the disks’ serial numbers on the disk label.

Bonus: mounting disk partitions NOT by its device name

For the similar reason, it is a good idea to identify disk or disk partitions by their UUIDs instead of Linux device names to avoid situations that Linux can not find the disks. Two examples are the configuration in grub’s config file and the /etc/fstab for automatic disk partition mounting. The format as follow can be understood by most of the tools in Linux:


YYYYY is the UUID for the disk.

All disks’ UUIDs can be listed by:

# blkid

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.


  1. For some systems that you can not find the disk serial number and when the disk is to be replaced , you may write data to the disk and see which disk is shinning (being super careful):

    # dd if=/dev/random of=/dev/failed-disk
  2. An alternative way to find out a disk’s serial number if by `smartctl` which can be installed by `yum install smartmontools`:

    # smartctl -a /dev/sdb | grep Serial
Leave a Reply

Your email address will not be published. Required fields are marked *