I'm trying to shrink an 80GB preallocated CentOS VMDK that I've been given from a previous VMware environment, that I've been asked to get running on another host. The billing arrangement for this new running environment allows for the imported dick image to be no more than 50GB in size. Currently, only about 18GB has been used by the guest OS, leaving 62GB of "available disk space" on the VMDK.
Is there a procedure for shrinking a preallocated VMDK? I have of course considered creating a new VM from scratch at the correct size, but there is too much going on on the VM for the option to be feasible.
Any suggestions on shrinking the VMDK or cloning contents from one VMDK to a smaller VMDK would be much appreciated.
Thanks
Have you checked if the disk is sparse or preallocated? If it's sparse, then you can follow the guide in the article already mentioned by John (defrag in Windows and then shrink using VMware Tools). If you succeed you can use for example StarWind V2V converter to basically clone the vmdk to a new ESXi host. You need to connect to the source host, find your vmdk file, connect to a destination host and select the location where to put your vmdk. I used this procedure a couple of times and it worked for a sparse disk.
Yes. VMware KB 2019649 Defragmenting and shrinking VMware Workstation virtual machine disks. In short, backup and reduce the disks, then use VMware tools via
vmware-toolbox
.ESXi, preferred for servers, officially supports reduce only via V2V type migrations with converter. Search and you will find blog posts from people who have edited VMDKs directly, which is riskier.
Not being able to do a rebuild can be a problem depending on how paranoid your recovery or migration plans are. Bringing along the OS may include cruft. Normally restoring a virtual disk from backup, or V2V migrating it is easy. If you cannot for some reason, a file share with installers and configs allows a clean install option.