I would like to have backup feature without the guest knowing about it. It should be no downtime and the backup should be able to be done on a guest running a busy mysql database or similar. I have come to a conclution that this may only be possible with lvm, but maybe its possible with kvm/qemu also.
Lets say I want to make a backup of a database running inside a guest. I don't want the guest to provide me with functionality about making this backup. All should be done with the help of virtualization and the fact that a guest hard drive is located on a server.
qemu monitor has a snapshot feature that can make this happen. Turning on the snapshot functonality and the base image will be static and it will be possible to make a exact copy of this image. I can then do whatever I want with this snapshot. Like mounting it in another guest to make backups.
So, how can I make a snapshot of a guest precise in time without the guest knowing about it?
LVM snapshots
Sunday, November 16, 2008 - 07:46 chrisdewIf you have the storage for your virtual machine(s) as a logical volume within a volume group you can take a snapshot of the logical volume.
The 'real' logical volume continues to behave as normal.
The snapshot is a a snapshot of the volume as the time it was created. It uses minimal space within the volume group, as it only needs to store the blocks whose contents differ between the logical volume and the snapshot.
The only problem I'm having here is how to copy the snapshot to another disk without doing unneeded writes,
http://finalcog.com/synchronise-block-devices
Of course, as you're not telling the hosted VM's database that it is being backed up, snapshotting the VM's filesystem (s) will give you VM filesystem(s) in the same state as if the VM had been stopped uncleanly.
This may be 'good enough' for many circumstances. (Certainly better to need an fsck, rather than to have lost your data.)