Cloning a virtual machine disk without delta files or snapshots
To clone a virtual machine disk using the ESX/ESXi host terminal:
- Log into the terminal of the ESX/ESXi host.
- Navigate to the virtual machine’s directory using the cd command. It is located at:
/vmfs/volumes/source_datastore/virtual_machine/
- Confirm the destination directory where the clone will be copied to. Create this directory, if required.
For example, if this destination directory does not exist:
/vmfs/volumes/destination_datastore/virtual_machine/
Create the directory using this command:
mkdir /vmfs/volumes/destination_datastore/virtual_machine/
- Clone the virtual hard disk using the vmkfstools -i command after shutting down the virtual machine:
# vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdk
The output appears similar to:Destination disk format: VMFS thick
Cloning disk ‘/vmfs/volumes/Storage1 (3)/examplevm/examplevm.vmdk’…
Clone: 100% done.Notes:
- Encapsulate objects with quotes where appropriate to ensure spaces and other special characters are interpreted correctly.
- By default, the vmkfstools -i command will create a destination thick provisioned disk. If you would like the destination disk to be thin provisioned, add -d thin to the end of the above command.
Example:
# vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdk -d thin
Cloning a virtual machine disk with delta files or snapshots
To clone a virtual machine disk using the ESX/ESXi host terminal:
- Log into the ESX/ESXi host’s terminal.
- Navigate to the virtual machine’s directory using the cd command. It is located at:
/vmfs/volumes/source_datastore/virtual_machine/
- Confirm the destination directory where the clone will be copied to. Create this directory, if required.
For example, if this destination directory does not exist:/vmfs/volumes/destination_datastore/virtual_machine/Create the directory using this command:
mkdir /vmfs/volumes/destination_datastore/virtual_machine/
- Clone the virtual hard disk from its current snapshot delta point using the vmkfstools -i command.
# vmkfstools -i /vmfs/volumes/Storage1/examplevm/examplevm-000003.vmdk /vmfs/volumes/Storage2/examplevm_clone.vmdkThe output appears similar to:
Destination disk format: VMFS thick
Cloning disk ‘/vmfs/volumes/Storage1 (3)/examplevm/examplevm-000003.vmdk’…
Clone: 100% done.Note: If the process fails, try selecting the next snapshot delta point in the snapshot tree. The selected point or one of its parents may be corrupt.