• View Communities
    • Citrix Developer Network
      The place for unfiltered straight talk on Citrix products. Blogs, code downloads, best practices, APIs, and more can all be found here.
    • Citrix Ready Community Verified
      Does it work with Citrix? Application compatibility questions are a thing of the past with the new Citrix Community Verified site.
    • Blogs
      Learn the latest from the Citrix employees who are building application delivery infrastructure technologies.
    • Blogosphere
      The Citrix Blogosphere is a window into the thousands of conversations taking place about Citrix and Application Delivery.
  •  Sign In
XenServer Developer Network

0 downtime snapshot based XENServer 5.5 backup script.

Description

This script allows you to take snapshot based backups with xenserver 5.5. This script also comes with a helper script that allows you to purge the backup after a set number of hours.

Download

http://forums.citrix.com/servlet/JiveServlet/download/510-246630-1387688-27061/scripts.zipXEN-Backup1.1.zip

Configuration

backup.pl

 $backupdir = "/mnt/offsite/";	The directory you wish to backup to. This should be an NFS share or something rather large
#mail notification setup
$mailNotification = true; Enable Mail Notification, set to false to disable.

$MailTo = "helpdesk\@csinet.ca"; The email address you want to send notifcations to.
$MailFrom = "helpdesk\@csinet.ca"; The email address that the mail will come from (some smtp servers require this to be a valid exisiting email address.
$host = "CGL-XENServer"; The host name of the server
#Setup Strings
$Message = " \"XEN Backup Notification\n"; The fist line of the backup notifcation mail.

$TopicHeader = "[".$host ." XEN Server Backup Script] "; The topic of the email.
$Topic = "";

@skip = ('d9eac24b-887c-4e5a-a49a-2cbbf5490dd0'); This array needs to contain the uuid of your DOM0 machine and any other machines you want to skip.

purgeBackup.php

  $parseDirs             = array('/backup/XEN-Backup/Admin/',
                        '/backup/XEN-Backup/CGL/',
			'/backup/mailBackup/');	Directory's to cleanse of old backups
 $backupIdentifier      = 'xva';                Only grab filenames that contain this string
 $days                  = 5;                    Days of backup files to keep

 sendEmail

"hostname"             => 'backup.whatever.com',  the hostname of the server this is being run on (not required)


    "server"               =>'172.16.17.66', The ip address or hostname of your smtp server

crontab on nfs server

0 1 * * * /opt/purgeBackup.php >> /backup/XEN-Backup/purge.log

 crontab on the XENserver

 #this runs the backup script every morning at 1 am
01 01 * * * /root/scripts/backup.pl >> /mnt/offsite/backup.log 2>&1

To do:

  • Web based interface for downloading / managing / restoring vm's from backups. This is more for simplicity's sake as you can just rename the backup file to xva and double click it in windows to restore it.
  • Need to setup a XEN Server cluster capable of hot migrations to test functionality.
  • Break configuration out of backup.pl script
  • Figure out how to mount an SR in the DOM0 for remote sites. Backups can then be done to removable media (usb drives) or mirrored storage. Also create rsnapshot or rsynch script to move only the delta of the xva file to the remote backup storage.

Version 1.1:

  • Added HA support, once again thanks Roberto, (I do not have a way of testing that this works, it does not seem to affect the backup of non HA machines so let me know if it blows your server up).

Version 1.0:

  • Added Roberto Cespa's VMName patch. Can be seen at line 37
  • Added space removal to VMName. Line 38

 Disclaimer

These software applications are provided to you as is with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.

Tags

xenserver backup snapshot 55 perl script xenserver backup snapshot 55 perl script Delete
Enter tags to add to this page:
Please wait 
Looking for a tag? Just start typing.

Add Comment

Related Links