1

Is there any way to find the physical topology of a drive on the SCSI bus in linux?

here's an example:

>: for drive in $(find /dev/disk/by-path -name \*0|sort); do udevadm info --query=path --name $drive  ; done
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:0/0:2:0:0/block/sda
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:1/0:2:1:0/block/sdb
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:2/0:2:2:0/block/sdc
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:3/0:2:3:0/block/sdd
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:4/0:2:4:0/block/sde
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:5/0:2:5:0/block/sdf
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:6/0:2:6:0/block/sdg
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:7/0:2:7:0/block/sdh
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:8/0:2:8:0/block/sdi
/devices/pci0000:00/0000:00:02.2/0000:03:00.0/host0/target0:2:9/0:2:9:0/block/sdj

I can trace them up to the RAID card

>: lspci | egrep 02.2\|03.00
00:02.2 PCI bridge: Intel Corporation Xeon E5/Core i7 IIO PCI Express Root Port 2c (rev 07)
03:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2208 [Thunderbolt] (rev 01)

but I can't trace any further (port on the raid card or expander), the scsi target numbers are sequential, mind that I have four empty slots so I would have expected target numbers to "skip" a few.

thanks.

Christian
  • 21
  • 4

3 Answers3

1

Try lsscsi.
Especially lsscsi -c and lsscsi -H.

HBruijn
  • 72,524
  • 21
  • 127
  • 192
Dmitry Ilyin
  • 573
  • 2
  • 5
1

Ah, you have MegaRAID.

Try MegaCLI.

http://docs.avagotech.com/docs/12351587

http://erikimh.com/megacli-cheatsheet/

http://www.dell.com/support/article/us/en/19/623352/en

It can do a lot of stuff. You need "MegaCli -pdList -aALL"

Dmitry Ilyin
  • 573
  • 2
  • 5
  • Thanks, any idea is there's anything more generic, that would work on Intel onboard AHCI controllers, or PMC/Sierra/Adaptec? – Christian Jun 20 '16 at 22:42
  • Hmm, try `lsscsi` without options. It will output a block of numbers. Like: [ scsi_host,channel,target_number,LUN] But i'm not sure it will be meaningfull for your controller. Also read here: http://sg.danny.cz/scsi/lsscsi.html If it's still showing incremental values maybe you'll have to use vendor-specific tools. – Dmitry Ilyin Jun 20 '16 at 22:49
  • For Adaptec you need "arcconf". Like this `arcconf getconfig 1 AL` – Dmitry Ilyin Jun 20 '16 at 22:56
0

Thanks, but I tried all options to lsscsi, but they are still incremental.

>: lsscsi -H
[0]    megaraid_sas
>: lsscsi -c
Attached devices:
Host: scsi0 Channel: 02 Target: 00 Lun: 00
  Vendor: DELL     Model: PERC H710        Rev: 3.13
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 02 Target: 01 Lun: 00
  Vendor: DELL     Model: PERC H710        Rev: 3.13
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi0 Channel: 02 Target: 02 Lun: 00
  Vendor: DELL     Model: PERC H710        Rev: 3.13
  Type:   Direct-Access                    ANSI SCSI revision: 05
Christian
  • 21
  • 4