4

I have a VMware Workstation VMDK virtual hard disk file that is X GB. I have reduced the size of all partitions within the drive to less than Y size, with the remaining X-Y space being unallocated. However, VMware will not allow me to decrease the maximum size of the virtual disk file, it will only allow me to grow it.

How do I decrease the maximum size of a VMware VMDK hard disk? I want the disk to appear as the specified size to the guest OS.

Most of the articles I've found so far on "shrinking" are about optimizing and compressing a VMDK file, which is not what I want, I want to reduce the "maximum size" of the VMDK.

| improve this question | | | | |
2

First, you will need VMware's VDiskManager utility. If you do not already have it installed, you can download it here, scroll down to the "Attachments" section (has links for Windows, Mac, and Linux). You will also need OpenSSL if you haven't installed it already (Windows download link).

If the VMDK is not already in "Monolithic Flat" form, you'll have to convert it with with the command "vdiskmanager.exe -r sourceimage.vmdk -t 2 destinationimage.vmdk"

Next, make a backup of your disk.vmdk file (call it disk.vmdk.old or something), and open your disk.vmdk file with a text editor such as Notepad++ on Windows. Scroll down to the section called "# Extent description", it will look something like this: "RW 120000000 FLAT "disk.vmdk" 0". Take the size you want the disk to be in GB and multiply it by 2000000, for example, 30 GB would be 60000000. Replace the value in-between RW and FLAT with this number. Save the file.

Then, convert it again with the command "vdiskmanager.exe -r sourceimage.vmdk -t 2 destinationimage.vmdk". The new image now appears as the desired size on disk, and appears as the desired size to the VM, and the VM itself will still be able to boot.

That's it, you should now have a VMDK file that has a lower maximum size as you want. You can now increase the size of the partitions to fill any small amount of extra unallocated space that you left for yourself as leeway.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.