This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
virtualization:xenserver:xenserver_backup [2015/04/20 09:40] gcooper |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Free XenServer Backup System ====== | ||
- | |||
- | **Main Reference Article**: http:// | ||
- | |||
- | **Backup**: http:// | ||
- | |||
- | **Restore**: | ||
- | |||
- | :!: You can back up all the VM's, XenServer hosts, and metadata for a XenServer pool from a single XenServer host. | ||
- | |||
- | :!: Consider this a disaster recovery backup. | ||
- | |||
- | :!: Here we use an NFS mount for backup storage. | ||
- | |||
- | :!: XVA backups are compressed on the fly. | ||
- | |||
- | :!: This is a no-downtime script set; it backs up the VM " | ||
- | |||
- | ===== The Basic Idea ===== | ||
- | {{ : | ||
- | - The local Dom0 on the XenServer pool master runs cron | ||
- | - The '' | ||
- | - The '' | ||
- | - The '' | ||
- | - The '' | ||
- | - enters the correct directory | ||
- | - sources the '' | ||
- | - determines what is to be backed up from the '' | ||
- | - calls for a backup (via live snapshot/ | ||
- | - outputs to a log | ||
- | |||
- | ===== Prepare the NFS Mount and Test a Manual Backup ===== | ||
- | |||
- | :!: Choose one of your XenServers to be the backup server, generally the pool master. | ||
- | |||
- | :!: Here we assume you have a shared NFS folder ''/ | ||
- | |||
- | Mount the NFS share: | ||
- | |||
- | < | ||
- | mkdir /mnt/backup | ||
- | |||
- | vi /etc/fstab | ||
- | </ | ||
- | |||
- | Append: | ||
- | |||
- | < | ||
- | # Mount the backup share | ||
- | ip.of.nfs.svr:/ | ||
- | </ | ||
- | |||
- | Mount the share, check it's mounted and test a manual backup: | ||
- | |||
- | < | ||
- | mount -a | ||
- | mount | ||
- | xe vm-export vm="< | ||
- | </ | ||
- | |||
- | ===== Get Mail Working ===== | ||
- | |||
- | see also **[[networking: | ||
- | |||
- | Modify '' | ||
- | |||
- | < | ||
- | vi / | ||
- | |||
- | root=adminuser@yourdomain.com | ||
- | mailhub=mail.yourdomain.com: | ||
- | RewriteDomain=yourdomain.com | ||
- | FromLineOverride=YES | ||
- | UseTLS=YES | ||
- | AuthUser=smtpuser | ||
- | AuthPass=smtppass | ||
- | </ | ||
- | |||
- | ===== Install the Scripts on the Backup Server ===== | ||
- | |||
- | < | ||
- | mkdir -p /opt/backup && cd /opt/backup | ||
- | wget https:// | ||
- | unzip XenServerBackup.zip | ||
- | rm -rf __MACOSX/ | ||
- | chmod +x *.sh | ||
- | chmod +x dbtool | ||
- | cp -a ./dbtool / | ||
- | </ | ||
- | |||
- | ===== Configure the Scripts on the Backup Server ===== | ||
- | |||
- | :!: You might want to use IP addresses to control which network interfaces are used for the backups. | ||
- | |||
- | Change the names and filenames to the names you have for your XenServers according to the article: | ||
- | |||
- | < | ||
- | cd /opt/backup | ||
- | |||
- | vi cleanup.sh | ||
- | |||
- | vi audit.sh | ||
- | |||
- | vi meta-backup.sh | ||
- | |||
- | vi mailheader.txt | ||
- | |||
- | vi vm_backup.cfg | ||
- | |||
- | vi vm_backup.sh | ||
- | </ | ||
- | |||
- | ===== Testing ===== | ||
- | |||
- | Run the cleanup script and check for an e-mail message: | ||
- | |||
- | < | ||
- | ./ | ||
- | </ | ||
- | |||
- | Run the audit script and check for an e-mail message: | ||
- | |||
- | < | ||
- | ./audit.sh | ||
- | </ | ||
- | |||
- | Then run the metadata backup script. | ||
- | |||
- | < | ||
- | ./ | ||
- | </ | ||
- | |||
- | Now, make sure you have '' | ||
- | |||
- | < | ||
- | ./ | ||
- | </ | ||
- | |||
- | ===== Configure Scheduling ===== | ||
- | |||
- | :!: The ''/ | ||
- | |||
- | This will add '' | ||
- | |||
- | < | ||
- | cat << EOF > / | ||
- | |||
- | # XenServer VM Backup Scheduling | ||
- | 30 22 */2 * * root / | ||
- | 40 22 */2 * * root / | ||
- | 50 22 */2 * * root / | ||
- | 00 23 */2 * * root / | ||
- | |||
- | EOF | ||
- | </ | ||
- | |||
- | ===== Backup Your Backup Scripts ===== | ||
- | |||
- | Do this on each XenServer backup host (pool master) to back up your backup scripts and configuration to a '' | ||
- | |||
- | < | ||
- | # This assumes the backup share is mountable via ''/ | ||
- | mount /mnt/backup | ||
- | mkdir -p / | ||
- | cp -a / | ||
- | cp -a /etc/fstab / | ||
- | cp -a / | ||
- | cp -a / | ||
- | </ | ||