Match PCI address of SATA controller and SCSI address of attached disks

I think you can get what you want by cross referencing the output from lshw -c disk and this command, udevadm info -q all -n <device>.

For example

My /dev/sda device shows the following output for lshw:

$ sudo lshw -c disk
  *-disk                  
       description: ATA Disk
       product: ST9500420AS
       vendor: Seagate
       physical id: 0
       bus info: scsi@0:0.0.0
       logical name: /dev/sda
       version: 0003
       serial: 5XA1A2CZ
       size: 465GiB (500GB)
       capabilities: partitioned partitioned:dos
       configuration: ansiversion=5 signature=ebc57757

If I interrogate the same device using devadm I can find out what it's DEVPATH is:

$ sudo udevadm info -q all -n /dev/sda | grep DEVPATH
E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda

This string has all the info you're looking for regarding this device. The PCI address, "0000:00:1f.2", along with the SCSI address, "0:0:0:0". The SCSI address is the data in the 6th position if you break this data up on the forward slashes ("/").

Tags:

Linux

Pci

Sata

Scsi