rss.png profile for ebal on Stack Exchange, a network of free, community-driven Q&A sites
Clone a virtual machine

I needed to clone a virtual win2003 machine to a nas storage.
My storage is a lvm partition.

A. Suspend the virtual machine:

# virsh suspend win2003

B. Clone the virtual machine:

# virt-clone -d -o win2003 -n win2003clone -f /nas/storage/win2003clone.raw

This command will change the name, UUID, mac address and of course storage source.

C. Resume the virtual machine:

# virsh resume win2003

Remember that you have to change the IP of the clone, so that will not conflict with the original.

Some extra tips:

If you need to change something before the clone procedure, dump the xml from the virtual machine:

  1. Dump xml

# virsh dumpxml win2003 > win2003clone.xml
  1. Edit xml

# vim win2003clone.xml
  1. Clone the virtual machine

# virt-clone -d --original-xml=/home/ebal/win2003.clone.xml -n win2003clone -f /nas/storage/win2003clone.raw --force