User Tools

Site Tools


virtualization:citrix:xenserver_backup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
virtualization:citrix:xenserver_backup [2012/10/20 12:55]
gcooper
— (current)
Line 1: Line 1:
-====== XenServer Backup ====== 
  
-FIXME 
- 
-===== Local Backup Disk or CIFS Share ===== 
- 
-http://www.computerforums.org/forums/server-articles/how-setup-live-xenservers-backups-208663.html 
- 
-  * The ''CLEARDOWN.sh'' script reclaims disk space from deleted snapshots 
-  * ''startvmbackup.sh'' is the script that will start the live backups of our XenServer VMs 
- 
-==== Install on the XenServer Host ==== 
- 
-<file> 
-mkdir /home/backup 
-mkdir /VM_Backup 
- 
-# Use a command like this if you want to send backups to a CIFS share 
-#mount -t cifs "//192.168.0.20/VM_Backup" -o username=username,password=password /VM_Backup 
- 
-cd /VM_Backup 
-wget http://www.andy-burton.co.uk/files/xenserver_backup/xenserver_backup.tar.gz 
-tar -xzf xenserver_backup.tar.gz 
-chmod 777 v* 
-</file> 
- 
-=== startvmbackup.sh === 
- 
-<file> 
-vi /home/backup/startvmbackup.sh 
-</file> 
- 
-<file> 
-#!/bin/bash 
-set -x 
- 
-# Dismount then remount backup share to be sure it's mounted 
-umount -f /VM_Backup 
- 
-#mount -t cifs "//192.168.0.20/VM_Backup" -o username=username,password=password /VM_Backup 
- 
-/VM_Backup/CLEARDOWN.sh 
- 
-/VM_Backup/vm_backup.sh 
- 
-/VM_Backups/CLEARDOWN.sh 
- 
-sleep 120 
- 
-/VM_Backups/CLEARDOWN.sh 
-</file> 
- 
-<file> 
-chmod 777 /home/backup/startvmbackup.sh 
-</file> 
- 
-=== CLEARDOWN.sh === 
- 
-<file> 
-vi /VM_Backup/CLEARDOWN.sh 
-</file> 
- 
-<file> 
-#!/bin/bash 
- 
-coalesce-leaf -u $uuid 
-coalesce-leaf -u $uuid 
-coalesce-leaf -u $uuid 
- 
-xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-</file> 
- 
-<file> 
-chmod 777 /VM_Backup/CLEARDOWN.sh 
-</file> 
- 
-==== Configure The Scripts ==== 
- 
-Edit the ''vm_backup.cfg'' file: 
- 
-<file> 
-vi /VM_Backup/vm_backup.cfg 
-</file> 
- 
-Insert these two lines in the ''Settings'' section: 
- 
-<file> 
-# 
-# Settings 
-# 
- 
-VM_XENHOST=$(xe vm-list | grep 'Control domain on host' | awk -F ': ' '{ print $3 }') 
- 
-VM_XENUUID=$(xe vm-list params uuid=$(xe vm-list | grep -B1 $VM_XENHOST | grep uuid | awk -F ': ' '{ print $2 }') | grep resident-on | awk -F ': ' '{ print $2 }') 
-</file> 
- 
-Set log path: 
- 
-<file> 
-log_path="/VM_Backup/"$VM_XENHOST"/"$date".log" 
-</file>  
- 
-Set the backup destination: 
- 
-<file> 
-backup_dir="/VM_Backup/"$VM_XENHOST"/" 
-</file> 
- 
-Ensure only running VMs are backed up: 
- 
-<file> 
-backup_vms="running"  
-</file> 
- 
-Edit the ''vm_backup.lib'' file: 
- 
-<file> 
-vi /VM_Backup/vm_backup.lib 
-</file> 
- 
-Search for this line and add below it in the same if/then stanza: 
- 
-<file> 
-log_message "VM $uuid backup failed" 
-</file> 
- 
-<file> 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-                                sleep 10 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-                                sleep 10 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-</file> 
- 
-Search for this line and add below it in the same if/then stanza: 
- 
-<file> 
-log_message "VM $uuid backup succeeded" 
-</file> 
- 
-<file> 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-                                sleep 10 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-                                sleep 10 
-                                xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args:vm_uuid=$uuid 
-</file> 
virtualization/citrix/xenserver_backup.1350759333.txt.gz · Last modified: 2012/10/20 12:55 by gcooper