This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

Clone a VMware ESXi Virtual Machine from the Command Line

My version of VMware vSphere is obviously not the full “knock your socks off” version and prevents me from right clicking and cloning an existing VM.
Not to be downhearted, there is another way…

Pre-requisites:
– VMware vSpehere client.
– Access to the VMware ESXi server console & keyboard or an SSH client (like PUTTY for Windows).
– The VMware ESXi root user’s password.

Process:
– Create the new VM using vSphere client.
– Give it a very small hard disk.
– Remove the hard disk from the VM once created.

– Enable local tech support mode from VMware *console* screen, press ALT+F1 and log in as “unsupported” with the root password.
or
– Enable remote tech support mode from VMware *console* screen, then use an SSH client to log into the server as root.

– Once you have a command line, locate the source virtual machine’s datastore directory under /vmfs/volumes/<datastorename>:
# cd /vmfs/volumes/ds1/source_vm

– Change to the new target VM datastore directory:
# cd /vmfs/volumes/ds1/target_vm

– Now use vmkfstools to clone the disk (note the use of thin-provisioning, you don’t have to):
# vmkfstools -i "/vmfs/volumes/ds1/source_vm/source_file.vmdk" "/vmfs/volumes/ds1/target_vm/target_file.vmdk" -d thin

– Back in the vSphere client, add the new disk to the target virtual machine and boot it.

– Bob is your uncle.


Add Your Comment

* Indicates Required Field

Your email address will not be published.

*