How can I copy a Virtual Machine on VMWare ESXi 4 while maintaining Thin Provisioning?

I get around this by making copies with the OVFtool from a command line. It isn't perfect, but it does the trick for me (note: ovftool is an app that runs on a linux system somewhere, which then connects to the ESXi host):

#Copy a VM to an OVF (must be turned off, but you can hotclone it to a new VM first if you have vCenter):
ovftool vi://USER:PASSWORD@ESXIHOSTIP/VMNAME TARGETDIR/TARGET.ovf

#Deploy an OVF to an ESX[i] server with thin disks:
ovftool --name="Name of new VM" -dm=thin -ds=TARGET-DATASTORE SOURCEFILE.ovf vi://USER:PASSWORD@ESXIHOSTIP/

You could also try ghettoCloneVM.pl, which is a tool to clone a VM on an ESX or ESXi server without vCenter (but the page says you have to have the "licensed" version of ESXi, not sure if that means the free version won't work). It looks like it has the ability to clone to a thin disk, so it might work for you. I haven't used this tool myself, but it is something to try.


Use vmkfstools:

vmkfstools –i <sourcedisk> -d thin <targetdisk>

To use vmkfstools, you can utilize unsupported mode on the physical console, or using Remote CLI (RCLI). This document outlines how to use RCLI, with a complete section on vmkfstools alone:

vmware.com/pdf/vsphere4/r40/vsp_40_vcli.pdf

You can also use PowerCLI if you're licensed for ESXi:

$vm = get-vm "vmname"
Get-HardDisk -VM $vm | Copy-HardDisk "[Storage1]/destinationfolder" -DestinationStorageFormat thin