Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
This answer may help you out: Mapping ata device number to logical device name. Sorry that I am so late to the party. –  Kevin S Oct 20 at 15:43

5 Answers 5

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.

share|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
    
I suspect you're missing 'lsscsi' which will output something like : [0:0:0:0] disk ATA ST3500630AS 3.AA /dev/sda [1:0:0:0] disk ATA WDC WD5000AAKS-0 05.0 /dev/sdb [6:0:0:0] cd/dvd TSSTcorp CDDVDW SH-S202H SB00 /dev/sr0 Where ATA.1 is /dev/sdb and ATA.0 would be /dev/sda. –  GingerDog Oct 1 '13 at 12:13

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.

share|improve this answer
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
share|improve this answer

You want hdparm -i /dev/whatever.

share|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

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

share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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