Cloning a virtual machine disk without delta files or snapshots
To clone a virtual machine disk using the ESXi/ESX host terminal:
- Log in to the terminal of the ESXi/ESX 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
You see output 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 want the destination disk to be thin provisioned, add -d thin to the end of the preceding command.
For 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 ESXi/ESX host terminal:
- Log in to the ESXi/ESX 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.vmdk
You see output similar to:
Destination disk format: VMFS thick
Cloning disk '/vmfs/volumes/Storage1 (3)/examplevm/examplevm-000003.vmdk'...
Clone: 100% done.