Making Copy of KVM VM

Issues related to applications and software problems
Post Reply
gpmpa
Posts: 5
Joined: 2017/10/20 06:09:27

Making Copy of KVM VM

Post by gpmpa » 2017/11/23 09:41:11

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

poky
Posts: 107
Joined: 2013/03/27 12:18:03

Re: Making Copy of KVM VM

Post by poky » 2017/11/23 19:09:27

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.

gpmpa
Posts: 5
Joined: 2017/10/20 06:09:27

Re: Making Copy of KVM VM

Post by gpmpa » 2017/11/23 19:31:59

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

anderson_thomas
Posts: 96
Joined: 2011/11/21 10:19:41

Re: Making Copy of KVM VM

Post by anderson_thomas » 2017/11/25 06:12:37

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

gpmpa
Posts: 5
Joined: 2017/10/20 06:09:27

Re: Making Copy of KVM VM

Post by gpmpa » 2017/11/25 11:32:31

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

Post Reply

Return to “CentOS 7 - Software Support”