ESX Server- Cloning VM’s without Virtual Center!!!

If you would like to clone virtual machine on esx server without the help of virtual center here is the instruction to do so

log into esx server

su to root and type the following command

$ vmkfstools -i /vmfs/volumes/datastore/sourcevm/sourcevm.vmdk /vmfs/volumes/datastore/destvm/destvm.vmdk

this will clone the virtual machine from source to destination

once you have finished cloning

go to vi client and run file->new virtual machine

use custom instead of typical

give the same name as the destination virtual machine name

use next next until you get to point where it ask’s you for select disk change it to use an existing virtual disk and specify the path to .vmdk file

and click next and next and finish this job

Now you should be able to turn on the machine with out any issues

Hope this works for you 🙂

Advertisements

4 thoughts on “ESX Server- Cloning VM’s without Virtual Center!!!

  1. Thanks for the tip, it works great! I also found that I could clone live VMs if I just took a snapshot before running the above command. The snapshot points all disk changes at a seperate file so the .vmdk is closed. Of course, this is the equivalent of ripping the power cord out of your server so it’s probably a bad idea if file consistency might be an issue (e.g. Database, email, etc servers).

    Jay

  2. Can you please explain where you would create this script (such as using notepad on a Windows PC or in the ESXi server or using Putty) and how you would run this script? In the script, where do you identify the names of the source and target vm’s? Thanks

    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

  3. Which is the difference between this and a copy with ‘cp -r’ command os a copy using the datastore browser (right click on the datastore to open it).
    Thank you,
    Marco

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s