Use the vmkfstools command to create a copy of a virtual disk or raw disk you specify.

A non-root user is not allowed to clone a virtual disk or an RDM. You must specify the original file name or file path oldName and the new file name or file path newName.

 -i|--clonevirtualdisk oldName newName
      -d|--diskformat [thin|zeroedthick|eagerzeroedthick|rdm:device|rdmp:device]
      -W|--objecttype [file|vsan|vvol]
      --policyFile fileName

Use the following suboptions to change corresponding parameters for the copy you create.

-d|--diskformat specifies disk formats.

-W|--objecttype specifies whether the virtual disk is a file on a VMFS or NFS datastore, or an object on a Virtual SAN or Virtual Volumes datastore.

--policyFile fileName specifies VM storage policy for the disk.

By default, ESXi uses its native methods to perform the cloning operations. If your array supports the cloning technologies, you can off-load the operations to the array. Specify the -N|--avoidnativeclone option to avoid the ESXi native cloning.

This example illustrates cloning the contents of a master virtual disk from the templates repository to a virtual disk file named myOS.vmdk on the myVMFS file system.

vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk

You can configure a virtual machine to use this virtual disk by adding lines to the virtual machine configuration file, as in the following example:

scsi0:0.present = TRUE 
scsi0:0.fileName = /vmfs/volumes/myVMFS/myOS.vmdk

If you want to convert the format of the disk, use the -d|--diskformat suboption.

This suboption is useful when you import virtual disks in a format not compatible with ESXi, for example 2gbsparse format. After you convert the disk, you can attach this disk to a new virtual machine you create in ESXi.

For example:

vmkfstools -i /vmfs/volumes/myVMFS/templates/gold-master.vmdk /vmfs/volumes/myVMFS/myOS.vmdk  -d thin