Page 1 of 1

Making Copy of KVM VM

Posted: 2017/11/23 09:41:11
by gpmpa
Hi,
I do have 2 VMs running on CentOS 7 KVM environment.
I want to make either clone of VMs or copy of VMs as a backup.
Following is my scenario and advices on how to do that would be highly appreciated.

1.) VM-1 have only single qcow2 image deployed. qcow2 was originally 50GB and I deployed it as 1000GB using qcow2 expand. Currently this disk only have 65GB. If I copy this file using cp command and dump xml file would that suffice ? Or if I clone this VM using virt-clone how much size will it take? 1000GB or 65GB ?

2.) VM-2 have 2 qcow2 disks in the VM. How can I make copy of this VM.

Thanks in advance.

GPMPA

Re: Making Copy of KVM VM

Posted: 2017/11/23 19:09:27
by poky
I'm copying a sparse qcow2 VM image that is 500 GB in size, but has 60 GB of allocated blocks.
I copy this VM image using cp command and size is 60 GB.

Re: Making Copy of KVM VM

Posted: 2017/11/23 19:31:59
by gpmpa
Hi Poky,
Thanks for the response.
Does that mean I can just copy qcow2 image using cp command to backup VM ? Here I will need to cp xml file as well.
Or else should I use virt-clone to copy(backup) VM? What is the difference?
I will expect to run the VM later on incase of any requirement.

Thanks
Pamuditha

Re: Making Copy of KVM VM

Posted: 2017/11/25 06:12:37
by anderson_thomas
Hi gpma,

if the VM ist stopped (not running) using cp is a simple way. BUT to make a copy of the xml file. it's better to use

Code: Select all

virsh-dumpxml [VMName] > [VMName].xml
, because if you change the KVM-Environment or the Domain - you need a DUMP-File!

Thomas

Re: Making Copy of KVM VM

Posted: 2017/11/25 11:32:31
by gpmpa
Hi Thomas,
Thanks for the response.
Either virt-clone or cp will only take time to copy actual volume of the VM. right? I mean I have 1000GB allocated and only 110GB is used of VM now. either cp or virt-clone will take time only to copy 110GB right?

Thanks
gpmpa