Cloning A Virtual Machine in KVM

4794-96-20090910021400 KVM (for Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). More Information here.

KVM is now native to RHEL/Centos and has replaced Xen in RHEL 5.4.

What i have seen so far has been pretty interesting, but I have barely scratched the surface of KVM’s inner workings.

Anyway, to clone a virtual machine you need to run the virt-clone command to clone the virtual disk. This automatically creates the virtual machine for you and registers it in virt-manager.

#virt-clone –original vm01 –name vm02 –file /vol0/vm02.img

Note that you do not need to tell virt-clone the location of the existing virtual disk. It figures this out on its own based on the name of the existing virtual machine.

4 thoughts on “Cloning A Virtual Machine in KVM

  1. Sure. The other KVM host just needs to be able to access the new disk img file that you created. So they either need to share storage (like NFS or iscsi) or you need to manually move the new disk image to the other KVM server using scp

  2. Hi,

    So if I have 2 KVM, not common storage, I just need to run same VM on other KVM, can I clone it to other KVM… during it will be create disk file on other KVM?

    Thanks?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.