2

I have a Debian VM running on VMware where cat /sys/class/scsi_host/host?/proc_name returns the following output:

ata_piix
ata_piix
mptspi

I understand from this that the VM has three (virtual) SCSI HBAs.

How can I find out which of these HBAs (host0, host1, or host2) supports my VM's virtual disk?

vSphere Client shows the VM's Hard Disk 1 with Virtual Device Node: SCSI (0:0) Hard Disk 1 and its SCSI controller 0 as SCSI Controller Type: LSI Logic Parallel. The host is apparently running VMware ESXi 6.0.0.

rookie09
  • 573
  • 1
  • 5
  • 14

1 Answers1

1

There are a few ways of doing this - I've just listed two below.

  1. Use hwinfo if you have it installed:

    $ hwinfo --disk
    ...
    28: IDE 06.0: 10600 Disk
    ...
    SysFS Device Link: /devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/port-0:6/end_device-0:6/target0:0:6/0:0:6:0
    ...
    Driver: "mpt3sas", "sd"
    Driver Modules: "mpt3sas", "sd_mod"
    Device File: /dev/sdg
    ...
    

    The controller is in the SysFS Device Link (PCI ID 01:00.0 identifies it).

  2. Find the disks linked to your controllers:

    $ lspci
    ...
    03:00.0 Serial Attached SCSI controller: VMware PVSCSI SCSI Controller (rev 02)
    
    $ ls -l /sys/block/sd* |grep 03:00
    lrwxrwxrwx 1 root root 0 Dec 20 10:19 /sys/block/sda -> ../devices/pci0000:00/0000:00:15.0/0000:03:00.0/host0/target0:0:0/0:0:0:0/block/sda
    lrwxrwxrwx 1 root root 0 Dec 20 10:19 /sys/block/sdb -> ../devices/pci0000:00/0000:00:15.0/0000:03:00.0/host0/target0:0:1/0:0:1:0/block/sdb
    

    In the above, we find the PCI IDs for the disk controller(s) and then find which disks are attached to the controller we're interested in (in this case, 03:00 is the ID of the controller).

Note: The above command outputs are from two different machines.

mjturner
  • 492
  • 3
  • 9
  • I went for the 2nd way, it turned out to be `host2`, i.e. `mptspi`. BTW for my VM, `lspci` reports `SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)`. Thx for providing this quick answer. – rookie09 Dec 20 '17 at 11:03