Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 12.45 minutes in December 2020 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Match Windows Disks to VMWare VMDK Files – Do it with ease

by | Dec 29, 2020

Need to match Windows Disks to VMWare VMDK Files?

At Bobcares, we often handle requests from our customers to match windows disk and Virtual disks on a VMWare as a part of our Server Management Services.

Today let’s see how our Support Engineers match Windows disks and virtual disks (VMDK) on a VMWare VM.

When do we Match Windows Disks to VMWare VMDK Files?

While expanding the disk size of a VMWare virtual machine or deleting a disk, it is difficult to understand which VMware virtual disk matches the specific Windows VM disk.

When there are few disks, and they differ by their size, it is easy to find the disk we need.

But if there are several VMDK (or RDM) disks of the same size or several virtual SCSI controllers are there in a VM we will need to match the Windows disk to avoid errors.

How to Get SCSI Device Number in Windows and VMWare?

Small Computer System Interface (SCSI) number can be found with some easy and quick steps.

The steps to follow are given below:

1. First open the Disk Management console (diskmgmt.msc) in Windows.

The SCSI controller name and SCSI device number are not displayed in the list of disks.

2. Then to get the SCSI device number, we can right-click a disk and select Properties

 match windows disks to vmware vmdk files

We can see the device port for VMWare Virtual disk SCSI Disk Device is shown in the Location field of the General tab.

Location 160 = SCSI Bus Controller 0

Target ID 1 = device SCSI ID is 1

Finally by combining the information we will get the SCSI disk address: SCSI(0:1).

After that, we need to open the virtual machine properties in the VMWare vSphere Client.

And then find the disk that has the same Virtual Device Node number as the ID we have got. In our example, it is SCSI(0:1) Hard Disk 2.

 match windows disks to vmware vmdk files

If multiple virtual disks with different SCSI controllers are configured on a virtual machine.

Also, it is difficult to find the SCSI device number manually.

The SCSI controller numbers in Windows and VMWare will differ usually.

[Need assistance? We can help you!]

 

How to Match Windows Disk with VMDK by UUID/Serial Number Using PowerShell

One of the methods used by our Support Techs to map VMWare virtual disks to disks inside a guest VM is to compare their unique disk IDs

In VMWare this attribute is usually known as UUID (Unique ID), and in Windows – a Serial Number.

To get UUID and SerialNumber of a virtual disk using PowerShell.

Generally, all VMWare VMs have the disk EnableUUID=TRUE parameter enabled.

And to get information about disks in Windows, we can use the Storage module cmdlets or WMI queries.

If we have some VMs running Windows Server which does not have the Storage module, we will use WMI.

Run the following PowerShell command to get a SCSI controller number or a SCSI device number:


$DiskInfo = foreach ($disk in Get-WmiObject Win32_DiskDrive) {
[pscustomobject]@{
"DeviceID"=$disk.DeviceID;
"Caption"=$disk.Caption;
"Capacity (GB)"=[math]::Round($disk.size / 1GB,0);
"SerialNumber" =$disk.SerialNumber
"SCSIControllerNum"=$disk.scsiport;
"SCSIDeviceNum"=$disk.scsitargetid;
}
}
$DiskInfo|ft

We will see the disks as listed below:

* PHYSICALDRIVE0: SCSI Port 0, SCSI Target 0, Serial 6000c2939b157427dadbace321ed4973
* PHYSICALDRIVE1: SCSI Port 0, SCSI Target 1, Serial 6000c2950ee961954909938642bb03b4
* PHYSICALDRIVE1: SCSI Port 4, SCSI Target 10, Serial 6000c2995fc3c4928d6650596bb02cef

Then let us try to get SCSI controller numbers and UUIDs of the disks specified in the settings of the VMWare virtual machine. To view the VM settings, use the PowerCLI console.

Import-Module VMware.VimAutomation.Core -ErrorAction SilentlyContinue
connect-viserver ber-vmware1

$vmName="ber-man01"
$vmHardDisks = Get-VM -Name $vmName | Get-HardDisk
$vmDatacenterView = Get-VM -Name $vmName | Get-Datacenter | Get-View
$virtualDiskManager = Get-View -Id VirtualDiskManager-virtualDiskManager

$vmresults = @()
foreach ($vmHardDisk in $vmHardDisks)
{
$string = $vmHardDisk.Filename
$vmHardDiskUuid = ($vmHardDisk.ExtensionData.Backing.Uuid | ForEach-Object {$_.replace(' ','').replace('-','')})
$vmresult = "" | Select-Object vmHardDiskDatastore,vmHardDiskVmdk,vmHardDiskName,vmHardDiskSize,vmHardDiskUuid
$vmresult.vmHardDiskDatastore = $vmHardDisk.filename.split(']')[0].split('[')[1]
$vmresult.vmHardDiskVmdk = $vmHardDisk.filename.split(']')[1].trim()
$vmresult.vmHardDiskName = $vmHardDisk.Name
$vmresult.vmHardDiskSize = $vmHardDisk.CapacityGB
$vmresult.vmHardDiskUuid = $vmHardDiskUuid
$vmresults += $vmresult
}
$vmresults | ft

This script will connect to the vCenter (or ESXi) server and get the list of disks for the specified VM.

And the result will have  DataStore name, VMDK file path, disk number, disk size and UUID.

Finally, we can manually match the disks we see in the guest Windows OS with VMWare virtual disks by their UUIDs.

[Need assistance? We can help you!]

Conclusion

In short, we saw how to match windows disks to VMWare VMDK files. Also, we saw the easy steps followed by our Support Engineers to match this.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF