Identify disks in vCenter to partitions in Linux guest

What I am trying to accomplish is to correlate hard drive in vCenter to the disks in the Linux guest. So here it goes

Opening up settings for the guest in vCenter and moving to hardware tab, shows the lists of hard drives i.e. the .vmdk files. The SCSI id representation is generic - disk 1 is 0:0, disk 2 is 0:1 and so on.

On the guest, I checked the dmesg and found the sd* devices with their bus and target number. From there, I tried to deduce the relation but I am not sure whether this is the right approach or rather right thing.

[root@blah /]# grep -i attached /var/log/dmesg 
sd 0:0:0:0: Attached scsi disk sda
sd 0:0:1:0: Attached scsi disk sdb
sd 0:0:2:0: Attached scsi disk sdc
sd 0:0:3:0: Attached scsi disk sdd
sd 0:0:4:0: Attached scsi disk sde

Now I am trying to relate this disks with the hard drive information that vCenter tells me. I confirmed the h:b:t:l mapping with /proc/scsi/scsi and it looks sane to me.


Solution 1:

This is correct... kinda.

Use lsscsi. The SCSI device nodes correspond to the controller/target/device naming you see in VMware.

Extreme example:

root@vdp1:~/#: lsscsi
[0:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda
[0:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdb
[0:0:4:0]    disk    VMware   Virtual disk     1.0   /dev/sdj
[0:0:5:0]    disk    VMware   Virtual disk     1.0   /dev/sdk
[0:0:8:0]    disk    VMware   Virtual disk     1.0   /dev/sdm
[0:0:9:0]    disk    VMware   Virtual disk     1.0   /dev/sdn
[0:0:10:0]   disk    VMware   Virtual disk     1.0   /dev/sdo
[1:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sdc
[1:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdd
[2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sde
[2:0:1:0]    disk    VMware   Virtual disk     1.0   /dev/sdf
[3:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sdg
[4:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR00 1.00  /dev/sr0

enter image description here