This article provides information and instructions on the use of the vmkfstools command to convert virtual machine disks from one type to another.
VMware vSphere ESXi (All Versions)
The vmkfstools command offers the ability to clone virtual machine content and also convert from one virtual machine disk (.vmdk) format into another.
Note: The host operating system chosen to perform the conversion may not necessarily support running virtual machines via the output format defined. vmkfstools maintains the possibility of exporting virtual disks for use in other VMware products which support alternative disk formats.
To convert a virtual machine disk from one type to another:
vmkfstools -i input output -d format -a adaptertype
For example, to clone examplevm.vmdk from Datastore to Datastore 2 and thin-provision the destination copy:
vmkfstools -i "/vmfs/volumes/Datastore/examplevm/examplevm.vmdk" "/vmfs/volumes/Datastore 2/newexamplevm/newexamplevm.vmdk" -d thin
Note: For VMs that reside on vSAN, make sure to add -W vsan.
Note: Ensure the new destination directory is created prior to cloning the disks.
Note: Make sure to use the full paths; otherwise, you will see a similar error:
OBJLIB-VSANOBJ: VsanGetContainerIDByPath: Prefix /vmfs/volumes not found in path
Warning: If virtual machine snapshots or delta disks are present, ensure that the source chosen is the current snapshot delta disk. Failing to do so results in an outdated destination copy. However, when using the command, the corresponding descriptor file for the latest delta disk needs to be used when cloning the disk.
For example, to clone and/or convert a virtual machine disk with a snapshot (known as a delta disk), examplevm-000001.vmdk, as above, from Datastore to Datastore 2, with a thin-provisioned destination copy, run this command:
vmkfstools -i "/vmfs/volumes/Datastore/examplevm/examplevm-000001.vmdk" "/vmfs/volumes/Datastore 2/newexamplevm/newexamplevm.vmdk" -d thin
Notice that examplevm-000001.vmdk is selected as the input file instead of examplevm.vmdk. Snapshot delta disks include a sequence number to indicate their creation order. Selecting the latest delta disk ensures that all current data is cloned to the destination.
Note:
VMware Skyline Health Diagnostics for vSphere - FAQ
For more information on vmkfstools disk options check Virtual Disk Options
See Also: