Clone a Virtual Machine from the Command Line Using ESXi
It’s far simpler and quicker to duplicate or clone an existing VM, than it is to build one from scratch.
In this example you are cloning Host1 and calling it Host2
Note: Your datastore name may not be “datastore1”, so please modify these commands accordingly.
SSH into your ESXi host and create a directory to hold your new clone
This is the command line to clone (copy) your Host1 VM to Host2
Remember to use “-d thin” if you want to use thin provisioning for your virtual hard disks!
Register the Virtual Machine in ESXi
Creating a clone, from the command line, does NOT add it to your ESXi server’s inventory.
- Log in as root to the ESXi host with an SSH client.
- Run the command:
Note: Your datastore name may not be “datastore1”, so please modify this command accordingly.
I’ve had mixed results using this command to register the cloned VM. Sometimes it’s easier to run the New Virtual Machine wizard, select Custom, layout all the VM settings, then when its time to setup a Hard disk, select the option to use an existing hard disk and browse to the newly cloned vmdk file in the datastore.
This should be all you need to know to Clone a Virtual Machine from the Command Line Using ESXi.