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?

link|improve this question
feedback

4 Answers

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.

link|improve this answer
I do not have ide, but sata which seems to map to scsi on Ubuntu Lucid: root@na:/sys/bus/scsi/devices# ls 0:0:0:0 11:0:0:0 15:0:0:0 6:0:0:0 host0 host10 host12 host14 host16 host2 host4 host6 host8 target0:0:0 target11:0:0 target15:0:0 target6:0:0 10:0:0:0 14:0:0:0 3:0:0:0 7:0:0:0 host1 host11 host13 host15 host17 host3 host5 host7 host9 target10:0:0 target14:0:0 target3:0:0 target7:0:0. I am do not seem to be able to find the missing link. – mamruoc Mar 2 '11 at 8:57
feedback

You want hdparm -i /dev/whatever.

link|improve this answer
root@na# hdparm -i /dev/sdb /dev/sdb: Model=WDC, FwRev=80.00A80, SerialNo=WD-WCAVY1924737 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq } RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=50 BuffType=unknown, BuffSize=0kB, MaxMultSect=16, MultSect=16 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=3907029168 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120} [snip] Drive conforms to: Unspecified: ATA/ATAPI-1,2,3,4,5,6,7 I am still not able to see how I can determine which drive (sdX) corresponds to ata1.00 – mamruoc Mar 2 '11 at 7:44
@user70520: You wanted the serial number; there it is: “SerialNo=WD-WCAVY1924737”. – Teddy Mar 2 '11 at 7:54
I wanted the serial number, yes. but I want the serail number of harddrive which corresponds to ata1.00. That is my main problem, pfinding the link between ata1.00 and /dev/sdX – mamruoc Mar 2 '11 at 7:59
@user70520: Oh, you don't have the device name? Right - see separate answer. – Teddy Mar 2 '11 at 8:44
feedback

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).

link|improve this answer
Ok, using lshw, I get: /0/100/1c.1/0/0 /dev/sda disk 1TB WDC WD10EADS-00M. Is there any information about how mapping between /0/100/1c.1/0/0 with ata1.00? – mamruoc Mar 2 '11 at 11:44
@user70520: What do the ls ... /dev/disk commands I posted tell you? – Dennis Williamson Mar 2 '11 at 11:57
@user70520: What is it that's reporting the drive as "ata1.00"? Try this to get a list of serial numbers (and other information) about all your drives: for d in /dev/sd?; do sudo smartctl -i $d; done | less. – Dennis Williamson Mar 2 '11 at 12:06
I get SMART error in dmesg, thus I have to identify corect drives to replace: [2293721.950045] ata12.00: status: { DRDY } [2293721.950051] ata12: hard resetting link – mamruoc Mar 2 '11 at 12:36
I need to figure out which drive ata12.00 is. If I get either /dev/sdX or serial, I can figure out which drive I need to replace. – mamruoc Mar 2 '11 at 12:37
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.