How do I identify a physical Disk Port or Bay (mpt2sas)

I have a problem identifying the physical port or drive bay, e.g. of a failed MD RAID disk inside some enclosure.
Question: How can I identify the physical cable a disk is connected to?
*The final question: Which drive to pull from a RAID?
*
Any help would be highly appreciated.

Example:



=== situation after first boot ===

[0:0:0:0]    disk    ATA      Corsair Force LS 01.8  /dev/sda          <--- system disk connected to M/B
[2:0:0:0]    disk    ATA      Hitachi HDS72101 A600  /dev/sdb 
[2:0:1:0]    disk    ATA      ST3500830SCE     D     /dev/sdc 
[2:0:2:0]    disk    ATA      WDC WD3202ABYS-0 3B03  /dev/sdd 
[2:0:3:0]    disk    ATA      ST31000528AS     CC38  /dev/sde 
[2:0:4:0]    disk    ATA      WDC WD3000FYYZ-0 1K01  /dev/sdf 
[2:0:5:0]    disk    ATA      Hitachi HDS72101 A3MA  /dev/sdg 
[2:0:6:0]    disk    ATA      ST31500541AS     CC34  /dev/sdh 
[2:0:7:0]    disk    ATA      Hitachi HUA72107 AB0A  /dev/sdi 

=== (hot-) swapped disks 6 and 7 ===

[0:0:0:0]    disk    ATA      Corsair Force LS 01.8  /dev/sda 
[2:0:0:0]    disk    ATA      Hitachi HDS72101 A600  /dev/sdb 
[2:0:1:0]    disk    ATA      ST3500830SCE     D     /dev/sdc 
[2:0:2:0]    disk    ATA      WDC WD3202ABYS-0 3B03  /dev/sdd 
[2:0:3:0]    disk    ATA      ST31000528AS     CC38  /dev/sde 
[2:0:8:0]    disk    ATA      Hitachi HDS72101 A3MA  /dev/sdf 
[2:0:9:0]    disk    ATA      ST31500541AS     CC34  /dev/sdg 
[2:0:10:0]   disk    ATA      Hitachi HUA72107 AB0A  /dev/sdh 
[2:0:11:0]   disk    ATA      WDC WD3000FYYZ-0 1K01  /dev/sdi 

=== reboot ===

[0:0:0:0]    disk    ATA      Corsair Force LS 01.8  /dev/sda 
[2:0:0:0]    disk    ATA      Hitachi HDS72101 A600  /dev/sdb 
[2:0:1:0]    disk    ATA      ST3500830SCE     D     /dev/sdc 
[2:0:2:0]    disk    ATA      WDC WD3202ABYS-0 3B03  /dev/sdd 
[2:0:3:0]    disk    ATA      ST31000528AS     CC38  /dev/sde 
[2:0:4:0]    disk    ATA      ST31500541AS     CC34  /dev/sdf 
[2:0:5:0]    disk    ATA      Hitachi HDS72101 A3MA  /dev/sdg 
[2:0:6:0]    disk    ATA      WDC WD3000FYYZ-0 1K01  /dev/sdh 
[2:0:7:0]    disk    ATA      Hitachi HUA72107 AB0A  /dev/sdi 

b       Serial Number:      MSK5235H24MM1G
c       Serial Number:      9QGALV55
d       Serial Number:      WD-WCAT1H291414
e       Serial Number:      9VP8R3FR
f       Serial Number:      9XW02BEE
g       Serial Number:      JP6940HZ0VE5LF
h       Serial Number:      WD-WMC130270449
i       Serial Number:      GTF200P8GHTBWF

=== (hot-) swapped first and last drive ===

[0:0:0:0]    disk    ATA      Corsair Force LS 01.8  /dev/sda 
[2:0:8:0]    disk    ATA      WDC WD3202ABYS-0 3B03  /dev/sdb 
[2:0:9:0]    disk    ATA      ST31000528AS     CC38  /dev/sdc 
[2:0:10:0]   disk    ATA      Hitachi HDS72101 A600  /dev/sdd 
[2:0:11:0]   disk    ATA      Hitachi HDS72101 A3MA  /dev/sde 
[2:0:12:0]   disk    ATA      ST3500830SCE     D     /dev/sdf 
[2:0:13:0]   disk    ATA      ST31500541AS     CC34  /dev/sdg 
[2:0:14:0]   disk    ATA      Hitachi HUA72107 AB0A  /dev/sdh 
[2:0:15:0]   disk    ATA      WDC WD3000FYYZ-0 1K01  /dev/sdi 

b       Serial Number:      WD-WCAT1H291414
c       Serial Number:      9VP8R3FR
d       Serial Number:      MSK5235H24MM1G
e       Serial Number:      JP6940HZ0VE5LF
f       Serial Number:      9QGALV55
g       Serial Number:      9XW02BEE
h       Serial Number:      GTF200P8GHTBWF
i       Serial Number:      WD-WMC130270449

Hello karlheinrich,

i am not quite sure, whether i understood your problem correctly.

You know the serial number of each of your disks, so you should be able to identify every disk. The serial number is printed on the outside disk label (at least it is so with the disks i have).

If you can’t read the disk labels while the disks are plugged in the server you could put your server down once and note the serial number of each disc on its cable or on the drive bay which contains the disk. Or just keep a list of which serial number is in which drive bay.

When your server is running and /dev/sdx is reported as faulty

smartctl -i /dev/sdx

or

hdparm -i /dev/sdx

will give you the serial number of the physical disk which is known to the system as /dev/sdx and you will know which disk to pull.

I hope that is of any help to you.

Best regards

susejunky

Hello karlheinrich,

if you can read any German then you might wish to monitor this link: http://www.linux-club.de/forum/viewtopic.php?f=92&t=120627

Looks to me as if there a similar problem to yours would be discussed.

Best regards

susejunky

Thanks for both your replies, Susejunky!

  1. I actually need to identify the slot directly for a reason with a very long explanation trail :wink:
  2. thanks for the hint to the German thread. I do actually speak German reasonably well.

Solution:

find /dev/disk/ |grep sas|grep -v part |sort

if you want to know the model names and serial numbers as well:

find /dev/disk/ |grep sas|grep -v part |sort | xargs sudo /sbin/hdparm -I | grep 'Serial Number\|Model Number\|path'

The list will look similar to this one:

/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221100000000-lun-0:
        Model Number:       WDC WD1503FYYS-02W0B0                   
        Serial Number:      WD-WMAY01081265
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221101000000-lun-0:
        Model Number:       WDC WD2500YS-01SHB1                     
        Serial Number:      WD-WCANY3804283
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221102000000-lun-0:
        Model Number:       WDC WD6401AALS-00L3B2                   
        Serial Number:      WD-WMASY6196443
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221103000000-lun-0:
        Model Number:       SAMSUNG HD501LJ                         
        Serial Number:      S0MUJDWQ565868      
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221104000000-lun-0:
        Model Number:       WDC WD2503ABYX-01WERA1                  
        Serial Number:      WD-WMAYP4111923
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221105000000-lun-0:
        Model Number:       SAMSUNG HE502IJ                         
        Serial Number:      S1MTJ1BQC00849      
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221106000000-lun-0:
        Model Number:       ST1000DM005 HD103SJ                     
        Serial Number:      S246J9FC408514      
/dev/disk/by-path/pci-0000:02:00.0-sas-0x4433221107000000-lun-0:
        Model Number:       WDC WD7500AAKS-00RBA0                   
        Serial Number:      WD-WCAPT0025587