This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
virtualization:citrix:xenserver_backup [2012/10/20 12:26] gcooper |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== XenServer Backup ====== | ||
- | ===== Local Backup Disk or CIFS Share ===== | ||
- | |||
- | http:// | ||
- | |||
- | * The '' | ||
- | * '' | ||
- | |||
- | ==== Install on the XenServer Host ==== | ||
- | |||
- | < | ||
- | mkdir / | ||
- | mkdir /VM_Backup | ||
- | |||
- | # Use a command like this if you want to send backups to a CIFS share | ||
- | #mount -t cifs "// | ||
- | |||
- | cd /VM_Backup | ||
- | wget http:// | ||
- | tar -xzf xenserver_backup.tar.gz | ||
- | chmod 777 v* | ||
- | </ | ||
- | |||
- | === startvmbackup.sh === | ||
- | |||
- | < | ||
- | vi / | ||
- | </ | ||
- | |||
- | < | ||
- | #!/bin/bash | ||
- | set -x | ||
- | |||
- | # Dismount then remount backup share to be sure it's mounted | ||
- | umount -f /VM_Backup | ||
- | |||
- | #mount -t cifs "// | ||
- | |||
- | / | ||
- | |||
- | / | ||
- | |||
- | / | ||
- | |||
- | sleep 120 | ||
- | |||
- | / | ||
- | </ | ||
- | |||
- | < | ||
- | chmod 777 / | ||
- | </ | ||
- | |||
- | === CLEARDOWN.sh === | ||
- | |||
- | < | ||
- | vi / | ||
- | </ | ||
- | |||
- | < | ||
- | #!/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: | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | </ | ||
- | |||
- | < | ||
- | chmod 777 / | ||
- | </ | ||
- | |||
- | ==== Configure The Scripts ==== | ||
- | |||
- | Edit the '' | ||
- | |||
- | < | ||
- | vi / | ||
- | </ | ||
- | |||
- | Insert these two lines in the '' | ||
- | |||
- | < | ||
- | # | ||
- | # Settings | ||
- | # | ||
- | |||
- | VM_XENHOST=$(xe vm-list | grep ' | ||
- | |||
- | 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 }') | ||
- | </ | ||
- | |||
- | Set log path: | ||
- | |||
- | < | ||
- | log_path="/ | ||
- | </ | ||
- | |||
- | Set the backup destination: | ||
- | |||
- | < | ||
- | backup_dir="/ | ||
- | </ | ||
- | |||
- | Ensure only running VMs are backed up: | ||
- | |||
- | < | ||
- | backup_vms=" | ||
- | </ | ||
- | |||
- | Edit the '' | ||
- | |||
- | < | ||
- | vi / | ||
- | </ | ||
- | |||
- | Search for this line and add below it in the same if/then stanza: | ||
- | |||
- | < | ||
- | log_message "VM $uuid backup failed" | ||
- | </ | ||
- | |||
- | < | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | sleep 10 | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | sleep 10 | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | </ | ||
- | |||
- | Search for this line and add below it in the same if/then stanza: | ||
- | |||
- | < | ||
- | log_message "VM $uuid backup succeeded" | ||
- | </ | ||
- | |||
- | < | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | sleep 10 | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | sleep 10 | ||
- | xe host-call-plugin host-uuid=$VM_XENUUID plugin=coalesce-leaf fn=leaf-coalesce args: | ||
- | </ |