Friday, December 9, 2011

How To Clone a Virtual Machine on VMWare's free ESXi

Spent a few minutes looking for how to do this on Google...

Basically, there is no clone option in the free version of VMware ran by alot of smaller business companies.  In order to clone a VM, you have to get creative.

Here are the steps:

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.vmdkDestination 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.
  1. Make a new VM on this server
  2. 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.
My Advice:
  1. When you create the new VM, disable the network connectivity on it
  2. Create an ISO with SysPrep for the version of server OS you are using (server 2008 already includes it in the OS)
  3. Run sysprep on the VM if it was not ran prior to shutdown (as should be standard practice for a template).  You will know if the OS installation/configuration comes up when you start your new VM.
  4. After sysprep, connect the new VM to the network and proceed with configuration.


No comments: