Does /dev/disk/by-path correspond to SATA ports in linux

3

1

My /dev/sda is reporting a failure, so I need to swap it for a new one. I am trying to identify which physical port it is connected to (there are four of this drive type in the server, so I can't eyeball it, or see serials easily).

If I have this:

lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-0:0:0:0 -> ../../sda
lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-1:0:0:0 -> ../../sdb
lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-2:0:0:0 -> ../../sdc
lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-3:0:0:0 -> ../../sdd
lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-4:0:0:0 -> ../../sde
lrwxrwxrwx 1 root root   9 Apr 15 16:31 pci-0000:00:1f.2-scsi-5:0:0:0 -> ../../sdf

What are the chances that the first physical SATA port contains /dev/sda?

Note that I cannot run lshw due to a kernel issue, and hdparms -I doesn't give me any clues.

Paul

Posted 2012-04-19T04:57:13.690

Reputation: 52 173

Answers

2

I had to swap out the failed drive, and I can say that in this case at least, the path mapping in /dev/disk/by-path does map to the physical ports on the motherboard. I swapped the right drive!

This is a sample set of one instance, so it may be different for others.

Paul

Posted 2012-04-19T04:57:13.690

Reputation: 52 173

0

As far as I can remember, this may not be the same order as on the motherboard. To be perfectly sure, use

smartctl -i /dev/sda

to get the serial number of the HDD labelled as /dev/sda. (You may have to install smartmontools, but usually it is already there.)

Piotr

Posted 2012-04-19T04:57:13.690

Reputation: 101