Cloning a VM without VC

No Comments

taken from:

http://blogs.sun.com/danielc/entry/a_little_script_to_clone and http://hsukumar.wordpress.com/2008/05/14/esx-clone-without-virtual-center/

1. Log into the ESX server using the vmware infrastructure client and turn off the server you want to clone. 2. SSH into the server, sudo to root
3. run: /clone.sh <origina> <clone> example: /clone.sh “App Server 1″ “App Server 2″
4. Once the clone process finishs go back to the Vmware infrastructure client and create a new VM.
5. Select Custom configuration then browse through the options setting anything you’d like until you get to Select a disk. Browse to the vmdk that you cloned and select it, then select finish.
6. Power on the VM, log in and change the IP

The script:

SOURCEVM=$1
TARGETVM=$2
DATASTORE=/vmfs/volumes/MY-VM-STORE

mkdir $DATASTORE/”$2″

vmkfstools -i $DATASTORE/”$1″/”$1″.vmdk $DATASTORE/”$2″/”$2″.vmdk