When I wrote about moving VM on ESXi without VMotion or Storage VMotion, I forgot about one neat VMware feature: thin provisioning. Quoting VMware: “(…) Thin Provisioning, a key component of vStorage, allows over-allocation of storage capacity for increased storage utilization, enhanced application uptime and simplified storage capacity management. (…)”. This means that a virtual machine configured with a 20GB virtual disk and only using 7GB of real data will see a 20GB disk but the file will only consume 7GB on the ESX storage. If the VM uses more storage, the file will grow until it reaches 20GB. Since then, you can save the storage for other VM.
The thing is, when you manually move the virtual machines, using the copy/paste tweak from datastore browse windows, the destination VMDK files are expanded to their “Provisionned Size”. That is, you loose thin provisioning benefit. Here’s the tweak to rethin the VMDK files.
You’ll have to connect to the ESXi using SSH and use command line editing. There is no way to do it from the GUI (in the Free version) ; or at least, I didn’t find the way to do it.
Browse to the virtual machine storage directory and use the `vmkfstools` command:
# cd /vmfs/volumes/my_datastore/my_vm_directory # vmkfstools -E my_vm.vmdk my_vm.orig.vmdk # vmkfstools -d thin -i my_vm.orig.vmdk my_vm.vmdk Destination disk format: VMFS thin-provisioned Cloning disk 'my_vm.orig.vmdk'... Clone: x% done. (...)
Boot you VM to ensure everything went well and delete the thick file:
vmkfstools -U my_vm.orig.vmdk
Quite simple indeed!
Note that if you’re using thin-provisioning, you may do the initial copy using `vmkfstools` rather than the datastore browser. That will speed the process and prevent the previous copy/convert/delete steps.