Apparently vCenter Server provides the ability to clone VMs via the Client, but not if you’re just using ESXi and managing your host directly with the web client. It is possible however to clone a VM’s disk using the vmkfstools commanline utility as described in this post.
Here’s a summary of the steps:
Enable SSH from the ESXi web console: Host / Manage / Services
In my case I wanted to create a copy of an existing CentOS7 VM. SSH into your ESXi host, then:
vmkfstools -i CentOS7-1/CentOS7-1_0.vmdk CentOS7-2/CentOS7-2.vmdk -d thin
Next, create a new VM as normal, but on the Customize Settings dialog, press the X on the right to delete the disk created by the new VM wizard:
Next, press ‘Add new disk’, select ‘Existing hard disk’, then point to the copy of the VM disk that you created with the vmkfstools command:
Credit to this post for the tip to configure using an existing disk.
One Reply to “Cloning an existing VM on VMware ESXi using command line vmkfstools”
Doesn’t work for VMs in powered ON state. So it’s useless to me, but hey, it works for the powered off machines.