I am a free VMware ESXi user. Cloning VM is no way to be as easy as VMware Workstation or vCenter. As you know, for free user, you can only manage your ESXi host directly using vSphere client. Cloning will save your time tremendously when you want to have several machines with same configuration inside one host.
I will be cloning a VM which run under CentOS 6.3 64bit platform with VMtools installed and using following details:
ESXi version: VMware ESXi 5.0.0 build 768111
ESXi host: 192.168.0.10
Main VM name: CentOS-Test
Main VM IP: 192.168.0.51
Cloned VM name: CentOS-Clone1
Cloned VM IP: 192.168.0.52
1. We will use SSH to do cloning. You can enable SSH service (if disabled) by using vSphere client and connect to your ESXi host. Go to Configuration > Security Profile > Services > Properties > select SSH > Options > Start as refer to screen shot below:
2. Create the cloned VM using similar specification with the main VM. There is one different thing here that we DO NOT need to create the disk for this cloned VM because we will use the clone virtual hard disk which we will create in step #3:
3. Now we need to clone the disk from main VM to the cloned VM directory. Connect to ESXi host using SSH and run following command:
~ # vmkfstools -i /vmfs/volumes/datastore1/CentOS-Test/CentOS-Test.vmdk /vmfs/volumes/datastore1/CentOS-Clone1/CentOS-Clone1.vmdk Destination disk format: VMFS zeroedthick Cloning disk '/vmfs/volumes/datastore1/CentOS-Test/CentOS-Test.vmdk'... Clone: 100% done.
4. Once done, we will need to add the virtual hard disk into cloned VM using vSphere client. Edit the VM Properties > Add > Hard Disk > Use an existing virtual disk > locate the hard disk as screenshot below > Next > Next > Finish.
5. You will then should have the virtual machine properties summary as below:
6. Start the cloned virtual machine. Once you login into CentOS, you will realized that the network interface will be converted into eth1:
We need to run following command and restart the CentOS box to bring back the eth0 as this is actually the nature of VMware in cloning:
$ rm -Rf /etc/udev/rules.d/70-persistent-net.rules $ init 6
7. After reboot, you should see the network interface has been changed to eth0 as screen shot below:
Done! Even though it required more steps to clone, it still can save a lot of your time doing OS installation especially if you just want to use the VM temporarily.