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

    Like

  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?

    Like

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s