How to match and correlate Windows SCSI Disk IDs with VMware VMDKs

*Note: This is a repost due to moving my posts from SystemsGame.com to 2ninjas1blog.com”

This post comes from a colleague of mine who couldn’t find a great resource on how to correlate the Windows Disk in Disk Management, with the Virtual Disk presented by VMware.

When all the disks are different sizes it is easy, but sometimes they are the same…how can you be sure you are expanding the right disk?

These instructions/steps should allow you to correlate Windows Disks to VMDK Disks.

  1. RDP  to the Windows server in question and run this powershell script
Get-WmiObject Win32_DiskDrive | select-object DeviceID,{$_.size/1024/1024/1024},scsiport,scsibus,scsitargetid,scsilogicalunit | out-file -FilePath c:\OutputPhysicalDrive.txt

This script should allow you to match the OS disks to the VMDK Disks. The output will be referenced in later steps.

Example output

DeviceID : \\.\PHYSICALDRIVE3
$_.size/1024/1024/1024 : 9.99680757522583
scsiport : 3
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE6
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE4
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 4
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE0
$_.size/1024/1024/1024 : 59.996166229248
scsiport : 2
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE1
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE2
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 2
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE5
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

The second step is to get a list of your VMDK disk information by editing the virtual machine in question. 

The information you will be retrieving is the
Disk Name: “Hard disk 1”
Size: “60 GB”
Bus ID: 0
Disk ID: 0

SCSI (X:Y) Hard Disk under Virtual Device Node. The X:Y values are:

X = Bus ID
Y = Disk ID

Enter the Disk information for all VMDK disks into a table like the one below:

Reference OutputPhysicalDrive.txt and match up any OS disks to VMDK disk that have a unique size.

For the non unique drives you will need to match the Windows disk scsitargetid with the VMDK Disk ID.

The first 2 in the example below are both 50GB Drives.

DeviceID : \\.\PHYSICALDRIVE6
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE5
$_.size/1024/1024/1024 : 49.9993586540222
scsiport : 5
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

The next 3 are all 20GB drives.

DeviceID : \\.\PHYSICALDRIVE2
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 2

DeviceID : \\.\PHYSICALDRIVE1
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 2
scsibus : 0
scsitargetid : 1
scsilogicalunit : 0

DeviceID : \\.\PHYSICALDRIVE4
$_.size/1024/1024/1024 : 19.9936151504517
scsiport : 4
scsibus : 0
scsitargetid : 0
scsilogicalunit : 0

Hope this helps anyone else having the issue. I’ll loop around and update the PowerShell script I ended up using for this soon as well.

Thank you vRad for this great guide!

Share

4 comments

    1. Thanks for linking to it. Yeah I am going to try and dig up a Windows PS script I eventually created though I’m hoping there’s already better out there I can use and maybe improve upon given this post was originally submitted in 2012. I’ll definitely check into yours on the Linux side. Thanks again!

  1. This is a simple PowerShell Script I’m using:
    ———————————————-
    $SCSI = 0
    $PCIS = (1600,1700,1800,1900,1501,1601,1701,1801,1901)
    $SCSIList = Get-Disk | SELECT Location
    FOREACH ($PCI in $PCIS)
    {
    IF ($SCSIList.Location -like “*$PCI*”)
    {
    $SCSI++
    Set-Variable -Name “$PCI” -Value $SCSI
    }
    }
    Get-Disk | SELECT `
    @{Name=”Win Disk Number”;Expression={$_.Number}},
    @{Name=”VMware SCSI”;Expression={$_.Location.Trim(“PCIROOT(0)#PCI(“).Replace(“)#PCI(0000)#SAS(P00T”,”:”).Replace(“00)”,””).Replace(“1500″,”0”).Replace(“1501”,$1501).Replace(“1600”,$1600).Replace(“1601”,$1601).Replace(“1700”,$1700).Replace(“1701”,$1701).Replace(“1800”,$1800).Replace(“1801”,$1801).Replace(“1900”,$1900).Replace(“1901”,$1901).Replace(“:0″,”:”).Trim(“L”)}},
    @{Name=”Size GB”;Expression={$_.Size/1GB}},
    PartitionStyle | Sort-Object “Win Disk Number” | FT -AutoSize
    ———————————————-
    I’m assuming that VMware and Windows are ordering de Disk Locations numbers differently and that causes the issue.

    Windows: 1500,1501,1600,1601…
    VMWare: 1500,1600,….1501,1601….

    It only works with Windows Server 2012 and higher OS versions as [Get-Disk] is not supported in older Server OS versions.

    Please let me know if this works for you.
    Thx

Leave a Reply

Your email address will not be published. Required fields are marked *