XENBACKUP - Xen VM Backup Tool
easy incremental live backups for LVM and virtualization platforms
easy but smart incremental live backups for Xen VMs (and other LVM based virtualization platforms)
xenbackup / xen-host-allbackup
XEN / LVM Host Auto-Snapshot-Backup for Xen DomUs (live and online) (stable release version 1.1)
It could be used to snapshot backup any kind of Xen DomU LVM volumes (Linux, FreeBSD, NetBSD and windows) and should work on products like Citrix XenServer (untested) too. xenbackup aims to be a full smart backup solution for lvm based virtualization platforms. it should be usable for any kind of LVM based virtualization plattform where a host provides all backend filesystems / discs by LVM.
This Software provides easy automatic and grouped snapshot backups of LVM Volumes of hosted VMs and could be used even for other virtualization platforms with LVM backends (KVM / KQEMU and others).
Currently it uses backup-manager to create and manage the tarballs, but could be modified to provide other kind of backup tools or just any suitable archivers up to rsync. If there is any real interest, i would add this.
how it works?
the script (usually started in cron daily) mounts a backup device onto the Host system and then does backups from each of the LVM volumes by create and open a snapshot and take a backup from it (while the VM is live or not). For incremental backup, backup-manager is used to create and maintain the incremental tarballs etc..
After the job is done, xenbackup closes anything, unmount and destroy the snapshots. After all volumes are handled, the backup media is unmounted.
xenbackup sends email reports to hostmasters or monitor email addresses.
REQUIREMENTS
- install the "backup-manager" program
- "ssmtp" or any simple email sender program ("sendmail fake") for email notifications
- cron for automatic daily backups
INSTALLATION
As root on the LVM Host system ("Dom0" in XEN):
- untar the tarball onto root for your host system or untar it otherwhere and copy the files to the host system (if you prefer to use other pathes for scripts as working directories you may adapt them in /etc/xenbackup.conf )
- edit config file /etc/xenbackup.conf
- list your volumes in /etc/xenback_vols
- check config of backup-manager /etc/backup-manager.conf (mainly point BM_REPOSITORY_ROOT="/backup/guests" to the "BCKMNTP" mountpoint in /etc/xenbackup.conf )
config files:
/etc/xenback_vols
format: virtual machine name | filesystem "name" | lvm device | filesystem type | mount options
mydomu1|root|/dev/vgxen/mydomu1-root|ext4|noatime mynetbsd2|root|/dev/vgxen/mynetbsd2-root|ufs|ufstype=44bsd
/etc/xenbackup.conf
## BACKUP PATHES ###################################### # backup target device BCKDEV="/dev/sdb3" BCKDEV_FS="ext4" # backup device mount point BCKMNTP="/backup/guests" # snapshots temp. mount directory MNTSOURCEDIR="/4backup" # DomU + filesystems backup table SBCONFIGFILE="/etc/xenback_vols" ## LOGGING ###################################### # xenbackup logfile LOGFILE="/var/log/backup_managers.log" ## NAMINGS ###################################### # HOST hostname HOSTN=`/bin/hostname` # HOST domain name DOMAINN=`/bin/hostname -d` ## LVM PARAMS ###################################### # snapshot size / capacity SNAPSIZE="10G" ### EMAIL MESSAGING ###################################### EMAIL_FROM="monitor@syndicat.com" EMAIL_TO="monitor@syndicat.com" BIN_SENDMAIL=$(which sendmail) || $(which ssmtp) ### BACKUP-MANAGER ###################################### BM_CONFIGFILE="/etc/backup-manager.conf" BIN_BACKUPMAN=$(which backup-manager) || true ...
CHANGES
This is productive software, but comes without any warranty!
1.1
- tested stable / release version
1.0b
- various fixes / cosmetics
- default working pathes in tarball
- new working pathes
1.0a
- single config file
- generic pathes
- strong code cleanout
0.5
- initial working version
ToDo
- some kind of generic "installer"
ANY USAGE ON YOUR OWN RISK!!!
BE AWARE IN/WHEN CHANGING ANY OF THE BACKUP PATHES - DAMAGE OR DATA LOSS MAY HAPPEN IF YOU OVERWRITE YOUR HOST!!!