A backup utility for QEMU, KVM, XEN, and Virtualbox guests. Virt-back is a python
application that uses the libvirt api to safely shutdown, gzip, and restart guests.
The backup process logs to syslog for auditing and virt-back works great with cron
for scheduling outages.
Note that there is a --amount flag which controls the number of generations kept.
The default number is 3 generations.
Example cronjob:
- 2 1 /usr/bin/virt-back --path=/var/backups --quiet --backup vm1
15 23 5 /usr/bin/virt-back --quiet --backup vm2
Virt-back guest restore procedure
In this guide our guest vm2 has failed with a major corruption and we would like to
restore from our backups. We have our running production guest images in /KVMROOT and
our virt-back guest backups in /KVMBACK.
Overview:
Ensure the guest is shut off.
move the bad image file out of the way
untar the virt-back backup into place
power up the guest
Detailed Procedure:
Verify the guest is shut off by running:
virt-back --info-all
We noticed that vm2 was still running so we invoked:
virt-back --shutdown vm2
Move the corrupted image file out of the way:
mv /KVMROOT/vm2.img /KVMROOT/vm2.img.NFG
Unzip and unarchive the backup using the following command (note --strip
depends on your original --path depth):
sudo tar -xzvf /KVMBACK/vm2.tar.gz -C /KVMROOT --strip 1
When the untar completes, start the guest:
virt-back --create vm2
|