Recently, I received an email indirectly from a customer with a problem… they had a number of virtual machines with many virtual disks, as well as RDMs. the problem was that when they were trying to remove a VMDK, they didn’t have an accurate and reliable way to determine which windows drive would be removed.
After some searching on the Internet, I found someone grappling with this very same problem had beaten me to it… A gentleman by the name of Harry Aydemir posted the solution on his most excellent blog. You can read the original article here. While Mr. Aydemir provided me with the correct Powershell command, I am (hopefully) providing a more thorough examination of the issue below.
Setting up the virtual machine
Here, we see I added 6 virtual disks to a Windows 2003 Server:
- w2k3-unaligned.vmdk (8GB – actual System and Boot disk, SCSI ID 0:0)
- w2k3-unaligned_1.vmdk (virtual disk 2, 200 MB, SCSI ID 0:1)
- w2k3-unaligned_2.vmdk (virtual disk 3, 300 MB, SCSI ID 0:2)
- w2k3-unaligned_3.vmdk (virtual disk 4, 400 MB, SCSI ID 1:0)
- w2k3-unaligned_4.vmdk (virtual disk 5, 500 MB, SCSI ID 1:1)
- w2k3-unaligned_5.vmdk (virtual disk 6, 600 MB, SCSI ID 1:2)
Details of the Virtual Machine Settings
This is simply a screen shot of the virtual machine, illustrating the setup of the virtual disks.
Contents of the VMX file
Finally, the section of the virtual machine’s VMX file describing the hard disks is as follows:
- scsi0:0.present = “TRUE”
- scsi0:0.fileName = “w2k3-unaligned.vmdk”
- scsi0:0.deviceType = “scsi-hardDisk”
- scsi1.present = “TRUE”
- scsi1.sharedBus = “none”
- scsi1.virtualDev = “lsilogic”
- scsi0:1.present = “TRUE”
- scsi0:1.fileName = “w2k3-unaligned_1.vmdk”
- scsi0:1.deviceType = “scsi-hardDisk”
- scsi0:2.present = “TRUE”
- scsi0:2.fileName = “w2k3-unaligned_2.vmdk”
- scsi0:2.deviceType = “scsi-hardDisk”
- scsi1:0.present = “TRUE”
- scsi1:0.fileName = “w2k3-unaligned_3.vmdk”
- scsi1:0.deviceType = “scsi-hardDisk”
- scsi1:1.present = “TRUE”
- scsi1:1.fileName = “w2k3-unaligned_4.vmdk”
- scsi1:1.deviceType = “scsi-hardDisk”
- scsi1:2.present = “TRUE”
- scsi1:2.fileName = “w2k3-unaligned_5.vmdk”
- scsi1:2.deviceType = “scsi-hardDisk”
As you can see, the configured SCSI ID is called out not only in the virtual machine settings dialog, but also in the VMX file.
The Problem – Disk Manager!!!
Viewing the Disks in Windows
Above, we see a screen shot of Windows Disk Manager and all 6 disks presented to the Windows operating system.
Examine the Disk Properties
Right-click on the disk in Windows, and select properties.
Examine the Disk Properties of Disk 0
By examining the disk properties, we see that the ‘Location’ field clearly identifies the SCSI Bus and ID number of the disk. The above graphic shows the SCSI location of Disk 0, which according to our earlier efforts, is located at SCSI location 0:0.
Examine the Disk Properties of Disk 6
By examining the disk properties, we see that the ‘Location’ field clearly identifies the SCSI Bus and ID number of the disk. The above graphic shows the SCSI location of Disk 6, which according to our earlier efforts, is located at SCSI location 1:2.
The problem, as evidenced above, is that Disk Manager does not reflect the relationship of the disk to the SCSI controller in a fashion that correlates to the Bus and SCSI ID… more specifically, it hides the SCSI port ID.
The Solution – Windows Powershell
Open Windows PowerShell
Issue the following command in Windows Powershell:
Get-WmiObject Win32_DiskDrive | select-object DeviceID,{$_.size/1024/1024},scsiport,scsibus,scsitargetid,scsilogicalunit | out-file -FilePath c:output.txt
This will yield the Location (port, bus, scsi target id, lun id), size (in MB) and Device ID (also known as disk number in the windows gui) into a file. This should allow you to accurately correlate all the Windows disks to the virtual disk files in VMware. you will note that the ‘scsi port‘ values are skewed, however they still provide sufficient information to map the drives to their corresponding entries in the VMX file.
- deviceID : \.PHYSICALDRIVE0
- $_.size/1024/1024 : 8189.384765625
- scsiport : 2
- scsibus : 0
- scsitargetid : 0
- scsilogicalunit : 0
- deviceID : \.PHYSICALDRIVE1
- $_.size/1024/1024 : 196.10595703125
- scsiport : 2
- scsibus : 0
- scsitargetid : 1
- scsilogicalunit : 0
- deviceID : \.PHYSICALDRIVE2
- $_.size/1024/1024 : 298.0810546875
- scsiport : 2
- scsibus : 0
- scsitargetid : 2
- scsilogicalunit : 0
- deviceID : \.PHYSICALDRIVE3
- $_.size/1024/1024 : 392.2119140625
- scsiport : 3
- scsibus : 0
- scsitargetid : 0
- scsilogicalunit : 0
- deviceID : \.PHYSICALDRIVE4
- $_.size/1024/1024 : 494.18701171875
- scsiport : 3
- scsibus : 0
- scsitargetid : 1
- scsilogicalunit : 0
- deviceID : \.PHYSICALDRIVE5
- $_.size/1024/1024 : 596.162109375
- scsiport : 3
- scsibus : 0
- scsitargetid : 2
- scsilogicalunit : 0