Which hard drive corresponds to ata1.00 and ata12.00?

I have an Ubuntu installation which has a lot of hard drives. Two of these drives have hiccups and SMART is reporting errors. However, I cannot figure out how to determine which drive is ata1.00 and which is ata12.00. Is it possible to retrieve their serial numbers, as this would be easiest way to find the correct drives?


ls -l /sys/class/ata_port/ should show the link to PCI id. Then ls -l /dev/disk/by-path/ would tell you what /dev/* that that is assigned to.


Look at ls -l /dev/disk/by-path and find the sd* device that corresponds. Then look at ls -l /dev/disk/by-id for the model and serial number that corresponds to that sd* device.

You may find this helpful:

sudo lshw -class disk -short

(or try it without the -short but pipe it into less).


lshw -C disk

will get you drives, their product ids, and mount points.

*-disk:0
description: ATA Disk product: XXXX vendor: Seagate physical id: 0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: JC4B serial: XXXYYY size: 931GiB (1TB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 signature=0006ded4

You can then find their most recent mount info in /var/log/syslog, with something like (e.g. looking for disk /dev/sda)

cat /var/log/syslog | grep 'sda' -A 5 -B 5

for other info, you can also try

blkid

or

mount