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?
6 Answers
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).
- 64,083
You can look at the output of ll /sys/block which shall give you something similar to
total 0
drwxr-xr-x 2 root root 0 Aug 8 09:00 ./
dr-xr-xr-x 13 root root 0 Jul 9 14:55 ../
lrwxrwxrwx 1 root root 0 Aug 8 09:00 dm-0 -> ../devices/virtual/block/dm-0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop0 -> ../devices/virtual/block/loop0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop1 -> ../devices/virtual/block/loop1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop2 -> ../devices/virtual/block/loop2/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop3 -> ../devices/virtual/block/loop3/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop4 -> ../devices/virtual/block/loop4/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop5 -> ../devices/virtual/block/loop5/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop6 -> ../devices/virtual/block/loop6/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 loop7 -> ../devices/virtual/block/loop7/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 md0 -> ../devices/virtual/block/md0/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme0n1 -> ../devices/pci0000:00/0000:00:01.1/0000:01:00.0/nvme/nvme0/nvme0n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme1n1 -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:01.0/0000:23:00.0/nvme/nvme1/nvme1n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 nvme2n1 -> ../devices/pci0000:00/0000:00:03.1/0000:2d:00.0/nvme/nvme2/nvme2n1/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 sda -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:0a.0/0000:2c:00.0/ata6/host5/target5:0:0/5:0:0:0/block/sda/
lrwxrwxrwx 1 root root 0 Aug 8 09:00 sdb -> ../devices/pci0000:00/0000:00:01.2/0000:20:00.0/0000:21:09.0/0000:2b:00.0/ata1/host0/target0:0:0/0:0:0:0/block/sdb/
- 261
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
If you don't know the device name but know the bus number of an IDE harddrive, and want to find out the serial number, you can do:
cat /sys/bus/ide/devices/0.0/serial
Where "0.0" is the bus number.
- 5,424