Backup of KVM raw-images

fume-shroom asked:

` Hi,guys! I’m running qemu-img- on CentOS 6.3 using raw images for my virtual machines. Is there any way to safely backup guests, without stopping them? I’ve tried to make snapshot on a test guest, that wasn’t running but got an error: “live disk snapshot not supported with this qemu binary”. Does this means that raw format is not suitable for any type of snapshots, or is it something with my KVM package? I’ve read that suspending the guest is enough to perform dd operation, is that right? Please, can you share some of your best practice in this area?

My answer:

If you’re using raw image files then the only way to get a consistent snapshot is to suspend or shut down the VM.

You can take a snapshot using qcow2 image files without suspending the VM, but the snapshot becomes part of that file. This may or may not be appropriate, depending on your situation.

You would have more options if you were using a CentOS 7 or current Fedora hypervisor, such as snapshottable LVM volumes or ZFS zvols. On these modern systems you would virsh domfsfreeze the guest, take the snapshot, virsh domfsthaw the guest, and then backup the snapshot. This requires the qemu-guest-agent running in the guest.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.