
Abstract:
This article gives the steps to convert a thick provisioned virtual hard drive VMDK to thin provisioned on ESX 4 or newer.
Option 1
- Migrate the VM Guest to another datastore and change the advanced configuration of the hard drive to thin provisioned.
Option 2
If you can’t vMotion of migrate the VM to another datastore you can use the this the vmkfstool command from the VM host to convert it.
- Optional
- Login to the VM Guest
- Make sure the VMTools are updated
- Run an OS Defrag of the drives
- Use Microsoft SDelete
- http://technet.microsoft.com/en-us/sysinternals/bb897443
- Download and install on the VM Guest OS
- Run sdelete -c
- Power Off the VM Guest
- Login to the VM Host that has the VM Guest either by Power CLI or SSH
- You may need to enable SSH and ESX Shell to do this
- Browse to the VM Guest file location
- Example: cd /vmfs/volumes/mydatastore/vmname/
- Clone original disk to a thin copy
- vmkfstools -i SERVERNAME.vmdk -d thin thin-SERVERNAME.vmdk
- Rename the original disk
- vmkfstools -E SERVERNAME.vmdk orig-SERVERNAME.vmdk
- Rename the thin disk to the original disk name
- vmkfstools -E thin-SERVERNAME.vmdk SERVERNAME.vmdk
- Remove VM Guest from VM Host inventory
- Add the VM Guest back to the VM Host inventory
- This so the VM Host registers that it’s now a thin provisioned disk/s
- This may not be needed for vSphere 5
- Verify that the VM Guest boots and runs correctly
- Remove original Thick disk/s
- vmkfstools -U orig-SERVERNAME.vmdk