Skip to contentSkip to conversation

How to do an automated backup?

DISCUSSION Steve Lorimer 5 participants 5 messages Nov 3, 2008 – Nov 6, 2008 KVM

lore
Share & tools
lore
#0 lore raw

Ok, should be a simple question here: How to backup a KVM host image.

My first plan - failure:
1) Suspend / hibernate (using virsh ... save) image to disk
2) Backup vm disk image & suspend file
3) Backup .xml
4) Restore suspended image
This would accomplish a backup that could be reactivated very quickly as bootup would not even be required.
However, in testing it failed. Of two VM's tried, one worked, but the other one never came back up. The network interface never reenabled and this system itself sat maxing out it's cpu core until manually terminated.

My second plan:
1) Use virsh to shutdown the VM
2) Backup vm file & xml
3) Start vm (regular bootup)
This takes longer, but can be tolerated in order to get a backup. However, this fails also:
virsh -c qemu:///system shutdown kvmtest
The command fails to send any kind of shutdown request to the VM guest. As a result, the only thing that works is to kill it (the virsh command for that does work). However, this is not acceptable for a backup.

Nothing out of the ordinary in my system setup:
VM Server: Ubuntu Server
Guest OS's: Also Ubuntu

Any thoughts, advice?

#1 lore raw
Quoted 1 line · Steve Lorimer

Ok, should be a simple question here: How to backup a KVM host image.

this is far from a simple question.

it appears periodically on the Xen lists. with few exceptions, the best advice is to use traditional network backup software "from inside" the guests.

Signature · 1 line
Javier
#2 lore raw
In reply to Steve Lorimer
Quoted 1 line · Steve Lorimer

Ok, should be a simple question here: How to backup a KVM host image.

...

Quoted 10 lines

My second plan:
1) Use virsh to shutdown the VM
2) Backup vm file & xml
3) Start vm (regular bootup)
This takes longer, but can be tolerated in order to get a backup. However, this fails also:
virsh -c qemu:///system shutdown kvmtest
The command fails to send any kind of shutdown request to the VM guest. As a result, the only thing that works is to kill it (the virsh command for that does work). However, this is not acceptable for a backup.

"virsh shutdown" should work, provided you have a new enough version of libvirt (what version are you using?), you have the <acpi/> tag set in the libvirt XML, and your guest (what kind of guest is it?) is using ACPI. virsh shutdown works by sending an ACPI event to the guest, basically equivalent to hitting the soft power button on a piece of hardware. In recent testing, I was able to use virsh shutdown to shut down basically any 2.6 based Linux guest, and any Windows guest using ACPI.

That said, doing the backup "inside" the guest, as suggested by Javier, is probably a better solution.

Signature · 1 line
Chris Lalancette
#3 lore raw
In reply to Steve Lorimer
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Steve Lorimer
Sent: Montag, 03. November 2008 20:32
To: [email protected]
Subject: How to do an automated backup?

Ok, should be a simple question here: How to backup a KVM host image.

Hi,

Maybe you take a look to our Proxmox VE 1.0, including a GUI for doing scheduled KVM backups (with vzdump). Maybe you can pick some points for your, or you just move to Proxmox VE as we already solved this. You find all infos on http://pve.proxmox.com

Best Regards,

Martin Maurer

[email protected]
http://www.proxmox.com

#4 lore raw
In reply to Steve Lorimer
Quoted 10 lines · Steve Lorimer

Ok, should be a simple question here: How to backup a KVM host image.

My first plan - failure:
1) Suspend / hibernate (using virsh ... save) image to disk
2) Backup vm disk image & suspend file
3) Backup .xml
4) Restore suspended image
This would accomplish a backup that could be reactivated very quickly as bootup would not even be required.
However, in testing it failed. Of two VM's tried, one worked, but the other one never came back up. The network interface never reenabled and this system itself sat maxing out it's cpu core until manually terminated.

That's a bug. If you can reproduce this on the latest kvm, and provide instructions for us on how to reproduce this, we will try to fix it.

Quoted 8 lines

My second plan:
1) Use virsh to shutdown the VM
2) Backup vm file & xml
3) Start vm (regular bootup)
This takes longer, but can be tolerated in order to get a backup. However, this fails also:
virsh -c qemu:///system shutdown kvmtest
The command fails to send any kind of shutdown request to the VM guest. As a result, the only thing that works is to kill it (the virsh command for that does work). However, this is not acceptable for a backup.

Quoted 5 lines

Nothing out of the ordinary in my system setup:
VM Server: Ubuntu Server
Guest OS's: Also Ubuntu

Any thoughts, advice?

If your backing store supports snapshots (btrfs, lvm) you could create a snapshot while the guest is running, and backup the snapshot.

The integrity of the backup depends on whether the guest is able to recover from restarts.

Signature · 1 line
error compiling committee.c: too many arguments to function