Clonar no VMware ESXi

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

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

Fonte: http://blogs.sun.com/danielc/entry/a_little_script_to_clone


To attach the cloned virtual disk to a new virtual machine:

1. After the cloning completes, connect to the ESX Server host directly using the Virtual Infrastructure Client. 

2. Log in as an user with administrative rights. 

3. Right-click on the ESX Server host from the Inventory panel and click New Virtual Machine. 

4. Select the Custom option from the wizard and click Next. 

5. Select the Datastore where the new virtual machine files should be created. 

6. Select an Operating System and Version and click Next. 

7. Select the Number of virtual processors and click Next. 

8. Specify the amount of memory assigned to the virtual machine. 

9. Create network connections. 

10. Select a SCSI adapter type. 

11. Select the option Use an existing virtual disk when it comes to selecting virtual disk and click Next. 

12. Click Browse to navigate to the location were the new vmdk is created and select it. 

13. Complete the wizard and click Finish. 

14. Power On the virtual machine. It now boots through the newly created vmdk

Fonte: http://www.secure-eserver.com/?p=395

Comentários