Monday, June 6, 2016

Clone virtual machine without vCenter using ESXi

How to clone virtual machine without vCenter using ESXi base host machine, First think why we required to clone the virtual machine..? If we would like to make multiple virtual machines as same exact virtual machine. 
  Connect to the vSphere Hypervisior using vSphere client and power off the source virtual machine.

How to clone virtual machine without vCenter using ESXi

In order to clone first take snapshot of existing virtual machine to do that, Right click on the current virtual machine –> Snapshot –> Take Snapshot. Example is shown in below screenshot

0 Take Snapshot
Now Select the base host name and go to configuration tab –> Click on Security profile ( As shown in below screenshot )
1 Security Profile
Select SSH and Click on Options
2 Remote access
Start the SSH service to connect ESXi using Command line interface ( Refer Below screenshot )
3 Start SSH service
Start SSH service – Click on Ok
Login to the ESXi host command line interface using SSH service as root user (Below is the screenshot after login to the Command line interface)
4 cd datastore
Go to /vmfs/volumes/ directory and type ls -la for viewing the list of volues
# cd /vmfs/volumes/ 
# ls -la
Clone the disk file. To clone disk use below command
# vmkfstools -i /vmfs/volumes/datastore1/DC1/DC1-00001.vmdk /vmfs/volumes/datastore1/newclone.vmdk -d thin
5 Clone Disk
Now lets create an New Virtual machine with cloned disk
6 New virtual machine
Right Click on ESXi base host machine name and Click on New virtual Machine OR press Ctrl+n (As shown in above screenshot)
7 configuration typical
Now it will ask you which type of VM you would like to create (Next Step)
8 Name and location
Provide Virtual machine name
9 Select Storage
Select the Datastore where you would like to store your Virtual machine files
10 Guest Operating system
Select Guest Operating system (Windows, Linux Or Other)
11 Select VM Network
Now select How many NIC’s you want to create and Select the virtual machine NIC VLAN
12 Create Disk
Provide Disk size and select its type of provisioning preferred is thin
13 Ready to complete
Check Edit the virtual machine settings and click continue
14 Remoce existing disk
Select curent disk–> Click on remove. Remove existing Disk because we do not required. Add newly cloned disk to make this virtual machine as exact its parent
16 Hard Disk
click on add button to attach new one, Select Hard Disk Click Next
17 Use an Existing Virtual Disk
Select second option that is “Use an existing virtual disk” Click Next
18 Browse from Datastore
Browse datastore and select the new .vmdk file Click open then Click Next

clone virtual machine
Click Finish
That’s it Virtual machine successfully cloned.
Conclusion
We can also clone virtual machine using ESXi.