You will require SSH access to your Virtual Machine, read over my article Gaining SSH Access To VMWare ESXi which provides the steps required to gain SSH access.
Once you have SSH access, you just need to create a Virtual Machine Directory in your DataStore which should be located in “/vmfs/volumes/datastore1/”. Type the following.
mkdir /vmfs/volumes/datastore1/NewVM
You will then need to run the “vmkfstools” to clone the Virtual Machine.
/vmfs/volumes/4991bc35-5ced5b0c-a99e-00221953f98d # /sbin/vmkfstools -i /vmfs/volumes/datastore1/exch01/exch01.vmdk /vmfs/volumes/datastore1/newvmware/newvmware.vmdk
Destination disk format: VMFS thick
Cloning disk ‘/vmfs/volumes/datastore1/exch01/exch01.vmdk’…
Clone: 100% done.
/vmfs/volumes/4991bc35-5ced5b0c-a99e-00221953f98d #
The Virtual Machine should now be cloned.
Some may ask how you now create a new Virtual Machine based on this clone. You simply do the following.
- Make a new VM on this server
- Choose ‘Custom’ and when you get to the ‘Select a Disk’ portion of creation you will browse the datastore and select this newly renamed vmdk file.
Viola! Done!
Thanks dear, It really helped me…
+1,
Thanks!
Awesome – works just as described. Well done, helped me a lot.
Just what I was looking for. Thanks for the info
Hello!
I’ll share a simple way to clone live/running VMs on ESXi.
SSH into ESXi
#in the following you’ll see the VM number, in my case 9
vim-cmd vmsvc/getallvms
#create a snapshot for VM number 9 with a date
vim-cmd vmsvc/snapshot.create 9 snapshot-`date +%F-%a`
#check snapshots for VM number 9
vim-cmd vmsvc/snapshot.get 9
#create dir for new dir… this should already be created with a copy of vmx file ecc.
mkdir /vmfs/volumes/DATA/VM_cloned
##clone volume of running VM, snapshot just made
/sbin/vmkfstools -i /vmfs/volumes/DATA2/VM/VM.vmdk /vmfs/volumes/DATA/VM_cloned/VM.vmdk
#delete all snapshots (assuming you had no other useful snapshots… very rarely a good idea…)
vim-cmd vmsvc/snapshot.removeall 9
Cheers,
GG