Bulletproof tip on how to find the right Windows VMDK

I did this so many times already, and I never thought that I could document it, or put it somehow into a blog post. And maybe you already know how that works, how you can find the right Windows VMDK to resize it.

It’s not that complicated if you know what to search or look for. And it’s easy as pie when the VM has only one disk, or maybe two. But imagine a SQL server, which has like eight disks or more, depending on its setup or software recommendation? Then it might get tricky to catch the right VMDK at the first shot.

But this bulletproof guide should help you out! Maybe that gets a new category, bulletproof. We’ll see. But let’s get back to the main topic here.

How do I find the right Windows VMDK?

I deliberately write Windows because I only work on Windows machines for that blog post here and not Linux VMs. It might get another blog post for that sometime in the future. But that depends on the Linux distribution or flavor because Linux is not Linux (don’t hate me please). But there are Debians, RPMs, Unixes, and so many other derivates. Not always the same tools available, not the same commands or syntax. You’ll get the point. Let’s focus on Windows VMs for now.

So, you’ve got that huge VM with several disks, and you have to resize one of them. Lucky you if it’s the C: drive because usually, that’s the first VMDK. Usually. But this guide shows you how to find the right VMDK. And always, making the disk bigger is easier than shrinking it. So it’s better to find the right candidate in the first shot, isn’t it?

In the first step, let’s go into the disk management of the virtual machine, where you should resize the disk.

With more recent Windows versions, like 2012 and later, you can easily right-click the Windows start menu button and choose “Disk Management”.

Next, check the properties of the disk you have to resize. In my example, I’m going to resize disk 3, which has the drive letter G:.

Please keep track of the red-circled stuff, we need the location (which is 256 in this example) and also the target ID, which is 2.

Let’s get back to vCenter and create some magic now.

As for the next step, we need the VMX file of the affected virtual machine. Navigate to the datastore where the VM is stored. Depending on your environment, you might check the VM configuration first to see where the VMX file is. I always remember that location with “VM Home”, but obviously, it’s called “VM Config File” and it shows you the datastore and path where you can find the VMX file.

Go to that datastore, click “Files” and look for the folder that contains the VM / VM config file. Select the VMX file and click “Download”. Store it somewhere on your computer. We need it just to check the disk configuration, you can safely delete it afterward (the copy on your computer!).

Open the file with a text editor, like Notepad or Notepad++.

Do you remember the red-circled stuff from above? We need now the location, which is, in our example, 256, and which means SCSI PCI Slot Number 1 (scsi1.pciSlotNumber = “256”).

We now know that we have to look for a device on SCSI1.

Do you also remember the target ID from above? In our example, it was 2. That means that we now have to search for scsi1:2, which is device ID 2 on SCSI bus 1.

And it looks as we have a winner!

And how can I resize it?

We’ve got finally the disk name, which is, in our example, “DISKTEST01_3.vmdk“. Let’s resize this disk now in vCenter.

Go back to your vCenter and edit the VM configuration. Search for the correct disk name and just resize it.

When you rescan the disks now, you should see some unallocated disk space right on the correct disk. Right-click the volume and click “Extend Volume…”. Follow the wizard and just a few seconds later you’re done.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.