If you are running the free version of VMWare ESXi and move or copy a thin provisioned VMDK file to a new location, VMWare moves it as a think provisioned VMDK. This can cause your datastore storage requirements to grow, wasting 10s to 100s of gigabytes of space that’s actually “free” in the virtual machine guest.
If you are unfamiliar with thin provisioning, it allows a guest to format the entire virtual disk, but the VMDK containing that disk only grows to encompass whatever the underlying guest requires. For example, if you create an 80 gigabyte virtrual disk and install CentOS, a thin provisioned VMDK may only need 2 or 3 gigabytes.
Back to the original problem, you’ve copied your thin provisioned guests to a new datastore either using cp in the service console or the datastore browser. Now your 200 gigabytes are wasting two terabytes on your SAN or NAS. Luckily, you can use the service console to convert the VMDKs back to a think provisioned format.
Here are the basic instructions to carry out the conversion. You’ll have to power down the guest that you are converting, and be sure to back up your VM. I’m not responsible for your use or misuse of these instructions.
Create the destination directory.
Change directory to the source path.
Move all files, except the VMDK files to the destination.
mv *.nvram *.vmsd *.vmx *.vmxf *.log *.xml /vmfs/volumes/vSphere4_Thin-LUN1/VMNAME
Verify that only the VMDK(s) files remain in the source directory. If there are any VSWP files remaining, you can ignore them. Ideally, you should only have a VMDK and a matching -flat.VMDK file.
Copy (and convert to thin provisioning) the VMDK files. This must be done for all the VMDK and snapshot (delta) files that are remaining in the source directory.
vmkfstools -i DISK1.vmdk -d thin /vmfs/volumes/SourceDatastore/VMNAME/VMDKNAME.vmdk
Remove the existing VM from inventory, then import the VM from the new location using the vSphere client.
Once you start the guest VM in vSphere client, be sure to answer the question about moving or copying the VM or the VM will not completely start. Once you have verified the VM starts and runs correctly, it should be safe to remove the old directory.
rm /vmfs/volumes/SourceDatastore/VMNAME -Rf