DC*3 Blog (Daniel Cifuentes, Desktop Computing from the Data Centre...)

A little script to clone a VM with VMware ESX/ESXi (but no VirtualCenter)

Tuesday Oct 14, 2008

I wanted to strike this one for my own records...

I was looking for an easy way to clone a VM without VirtualCenter and came across this, which worked like a charm, bits of which I had done before for other purposes...

http://hsukumar.wordpress.com/2008/05/14/esx-clone-without-virtual-center

So I came up with a little automation, good for when you have to "create a few"... Change according to your datastore!

Script: clone-system name-of-source-vm name-of-target-vm

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

mkdir $DATASTORE/"$2"

vmkfstools -i $DATASTORE/"$1"/"$1".vmdk $DATASTORE/"$2"/"$2".vmdk

[2] Comments
Like this post? del.icio.us | furl | slashdot | technorati | digg