Free version of VMware ESXi don’t provide option to clone virtual machine. If you want to clone a VM, you need to purchase expensive vSphere license.
There is a work around for this, you need to clone disk of an existing Virtual machine using vmkfstools.
To make clone of a VM disk, SSH into your VMWare ESXi server as user root. Then create clone of disk with
vmkfstools -i "source.vmdk" "destination.vmdk"
For new VM, i created a directory. Path to datastore directory may be differnt on your server, you can find it using “df -h” command and checking the file system.
mkdir /vmfs/volumes/disk2/ubuntu-clone/
Shutdown the Virtual Machine you want to clone the disk from. Run
[root@ns3048991:~] vmkfstools -i "/vmfs/volumes/disk2/Ubuntu/Ubuntu.vmdk" "/vmfs/volumes/disk2/ubuntu-clone/ubuntu-clone.vmdk" Destination disk format: VMFS zeroedthick Cloning disk '/vmfs/volumes/disk2/Ubuntu/Ubuntu.vmdk'... Clone: 100% done. [root@ns3048991:~]
In screenshot below, i first tried to clone with out creating destination folder. That resulted in error. After creating destination folder, vmkfstools command worked.
Creating VM using cloned disk
Login to VMware ESXi web interface. Create a new VM. On the step where you select hardware, delete the existing Disk. Add a new disk, browse and select the newly created clone disk. In this case – “/vmfs/volumes/disk2/ubuntu-clone/ubuntu-clone.vmdk”
Once the VM creation is finished, you will be able to start the new VM. You can create a VM, then use it as the template for creating new virtual machines.
See VMWare
Leave a Reply