Monday, March 28, 2011

Cloning an ESXi 4.1 VM

After fiddling around with a lot of bad advice I finally found one suggestion that worked for me to clone an ESXi VM. It's not elegant or quick....

so being relatively new to the vmware world and a somewhat reluctant participant since the test system i'm using won't support Hyper-V and only VMware, it's comforting to see that there's a Unix kernel lurking in it's background and that some of the old familiar shell commands work, like ls and df, etc. Unfortunately I don't see a man-pages facility which would help.

the long and short of this cloning thing was found here . Essentially you ssh into the esxi host and run a vmkfs -i command to clone the vm.

  1. If you hadn't activate SSH then do this as described here.
  2. Create a new VM with the same configuration as the machine you wish to clone.
  3. By creating the VM you also created its virtual disk (*.vmdk).
  4. Delete this disk (we will replace it with the clone) by using the “Datastore Browser” or SSH on ESXi.
  5. Connect to your ESXi by using SSH.
  6. type the following command (here “ubu-10.04-server” is the template).
vmkfstools -i /vmfs/volumes/datastore1/ubu-10.04-server/ubu-10.04-server.vmdk /vmfs/volumes/datastore1/newmachine/newmachine.vmdk
Destination disk format: VMFS zeroedthick
Cloning disk '/vmfs/volumes/datastore1/ubu-10.04-server/ubu-10.04-server.vmdk'...
Clone: 100% done.
  • boot your new machine and configure it.