Backup of KVM guests when using qcow2 disk files

6,919

Solution 1

You'll want to coordinate that within the guest .. ideally you:

  1. Cause any RDBMS running in the guest to flush its cache
  2. Tell Linux to sync disks (sysrq S or just type 'sync')

Then just make a qcow2 snapshot of the guest. You then have a read-only immutable copy of the guest FS as it was when you took the snapshot.

This page offers a lot more information than you probably wanted to know on how snapshots (and qcow2 itself) works. See also the accepted answer to this question.

Solution 2

I was looking for similar solution, now I'm using software RAID+LVM2 volume for libvirt storage, I've taken a snapshot and few times (about 8-10) I had to revert to backup and it worked, even if Win guest said: unclean shutdown. I'm not using hardware RAID anyway, software is enough but prorably SCSI/SAS + HW RAID + battery backup is the best solution for LVM2 snapthots (due to double write to different places on hard disks when snapshot is taken). I always use full-filled RAW volume files or even direct attached drive/partition, recenty I've enabled write cache for VMs drives which increased write speed A LOT! Now I'm considering QCOW2's built-in snapshots to turn off LVM2, becouse it's very slow when compared to RAW partition, like EXT4.

Share:
6,919

Related videos on Youtube

rkthkr
Author by

rkthkr

I got very little time for serverfault nowadays... A Free Software programmer, Systems Engineer, Administrator, Scuba Diver, Husband, Father of two and a born again Rocketeer

Updated on September 17, 2022

Comments

  • rkthkr
    rkthkr over 1 year

    I got a Ubuntu (hardy) system used for virtualization using KVM. Each guest got it's own qcow2 file used as disk. Guests are running Ubuntu (hardy). What would a good backup strategy be for such a setup? I would prefer not to shutdown the guests during backup.

  • rkthkr
    rkthkr over 14 years
    Can I do the snapshot "online"? Do you know of any tools that can help?