Find out the PCI slot ID of the SCSI controller on the VM and make a note of them. You will need them in Step2 PCI slot ID of the SCSI controller on the VM can be obtained by running a simple command on the vmx for the VM
cat /vmfs/volumes/<data store name>/vmname/vmname.vmx | grep scsi | grep pci
The above command will generate an output similar to.
In the above output the first highlighted number is the address of the controller where the /dev/sda is attached and the second highlighted number is target ID. Hence, /dev/sda is target 1 on the Scsi controller present at address 0000:03:00.0
Now to find a relation between address of the controller and the PCI slot number run following command on the Linux machine. Run the below command for each PCI slot ID obtained in Step1.
cat /sys/bus/pci/slots/160/address
The output of the above command will be the address of the controller and will look like
0000:03:00
What we know so far:
/dev/ sda is target 1 on the Scsi controller present at address 0000:03:00.0
Scsi controller present at address 0000:03:00.0 is scsi0
From the above information we can conclude that /dev/sda is target 1 on scsi0 which is nothing but scsi0:1
Windows:
On a Windows machine open “Disk Management” this can done by following
Start > run > diskmgmt.msc
Right click on the disk number and select properties. Let say we do this for Disk 0, it will open a page similar to
On the above page “Location:” provide you following information PCI Slot ID: 160 (Location 160) Target ID: 0 (Target Id 0) Partition: 0 (LUN 0)
What we know so far:
Disk 0 is target 0 on the Scsi controller present at PCI Slot ID 160
PCI Slot ID 160 is scsi0
From the above information we can conclude that Disk 0 is target 0 on scsi0 which is nothing but scsi0:0
Note: For windows system in some corner cases location information can be off. Please Verify the disk size as well.
Step3:
Find out the vmdk files and Naa ID of the data store. Once you have found the Scsi ID of the guest OS disk, we can follow the steps below to obtain the vmdk files and Naa ID information To find vmdk files associated with the VM run following command
cat /vmfs/volumes/<data store name>/vmname/vmname.vmx | grep –i vmdk
The above command will generate an output similar to.
From the above output we see that the VM has disks located on two data stores scsi0:0.fileName = “vmname.vmdk” and scsi0:1.fileName = “vmname_1.vmdk” exits in VMs home directory. scsi0:2.fileName = “/vmfs/volumes/4ce381e2-8a5b2a05-b0a7-18a90571b0ec/vmname_2.vmdk” exits in a separate datastore. Use the information obtained in Step1 and Step1 to map vmdk to an in guest disk number.
In this case disk 0 for windows VMs is vmname.vmdk
To find Naa Id of the data store associated with vmdk run following commands
esxcfg-scsidevs –m | grep <data store name>
For example, To find Naa Id of the data store associated with vmname_2.vmdk run following commands