Pages

Sunday, April 21, 2024

VMware vCenter Converter - Reclaim Unallocated Space in VM on Host Machine

 


Intro:

If you need to reclaim unallocated space in a VMware Workstation virtual machine then this article is for you. There's many reasons you may want to shrink the OS drive. You could have overallocated when the VM was created, you need to reclaim space on the host drive, etc.

In the following example we have a hdd that's overallocated and we'd like to reclaim space on the host machine.

Keep about 20-40gb of buffer space if the VM you built was for a specific purpose and is not intended to grow. You'll need to use your judgement here. Length of time this VM will stay active compared to the size of future updates to Windows and your applications if applicable.

I.e., you over allocate the OS drive to 120gb. Install and update Windows 10, load all drivers and applications. Let's say this consumes 40gb. Leave yourself 20gb as a buffer. 120gb - 40gb - 20gb = 60gb.

Open Windows Disk Management and shrink the volume from 120gb to 60gb. Windows Disk Management deals in MB not GB so shrink by 61,440 MB (60 GB * 1,024 MB/GB = 61,440 MB).


How To:

Prerequisites for source vm:
  1. Power on your VM, open Windows Disk Management and shrink the C:\ drive down less 20gb.
  2. Shut down the machine when this is done. Do not suspend it!
========================================

1. First off sign up and grab a copy of VMware vCenter Converter here or here. The Broadcom acquisition will probably render these links invalid after May 2024.

  • The transition to Broadcom starts on Tuesday, April 30, 2024, at 5:00 p.m. (PDT)
  • Starting Sunday, May 5, 2024, at approximately 7:30 p.m. (PDT), VMware customers can access all support-related information, as well as downloads, product licenses, and active entitlements, on the Broadcom Support Portal.
2. You essentially want the client installation portion but install the client and server portions. You never know when you'll need them.

3. Open VMware vCenter Converter Standalone and connect to the local machine.

4. Click "Convert Machine".



5. Select the existing VMX file.



6. Select the destination folder for the converted VM. Make sure the folder exists prior to selecting it. This software will not automatically create a new folder.



7. Select "Data to copy" and notice in the example we're starting with a 120GB disk.



8. Select "Select volumes to copy".



9. Notice after the selection that only the actual used disk space will be used to create a new VMDK. In this case I took a guess when shrinking the volume and came up with 59.45gb of total disk space. The OS and applications only take up about 40gb.



10. Click "Finish" to queue the conversion. This can take some time depending on the size of the original VM. The conversion creates a new VMDK.





Conclusion:

I'm sure this can be done with VMware's command line tools, but when in a pinch this works well. It generates a new VMX and a new VMDK ready to go.



πŸ‘½