Skip to main content

Script XenServer Backups

After upgrading to Citrix XenServer 6.1 Advanced Edition a while ago, I have been enjoying great features, such as "High-Availability" and "VM Protection Policies". I especially liked VM protection with automated snapshots and exports that took practically no time to set up and worked fairly well for a number of small to midsize environments we have partitioned our virtual infrastructure into. Well, my enjoyment proved to be short-lived, XenServer 6.2 came along delivering scalability improvements and also introducing many changes, click here for more information.

I found many of those changes (like XenServer being fully open source; inclusion of software maintenance; simple, single edition packaging; socket based perpetual and annual licensing; etc.) interesting and welcomed them with open arms. All but one:
This spelled the end of my automated protection days (once again, read more about it here). Luckily, I was still able to draw on my by-now-virtually-nonexistent Linux skills (yes, with a lot of help from plentiful online resources) to replace automation magic with scripting and scheduling.

In case someone else finds this helpful and to give credit where it's due, here's a collection of resources:

  • Great post that provides step-by-step instructions and script samples for pretty much everything you are going to need to get started - http://www.charleslabri.com/back-up-xenserver-6-to-network-share-with-fancy-scripting-and-lots-of-fun-and-no-downtime/
  • Email notifications required a quick modification of the "/etc/ssmtp/revaliases" file (a line similar to root:username@xyz.com:smtp.xyz.com); more details here
  • To get things scheduled right refer to one of many resources that describe cron, for example this one
  • To delete old backup files a quick refresher on the find command might be needed, check out the following reference or this two part article - part 1, part 2
  • Finally, if you run Windows based VMs and want to use VSS (seems to work well under W2K8 not so much under W2012), you may want to look into running "C:\Program Files\Citrix\XenTools\install-XenProvider.cmd" to install VSS provider
That's it. I have used information above to schedule jobs that take VM snapshots, export them to NFS-based shares, and keep a set number of them. So far, everything works pretty well.

Comments

Popular posts from this blog

Mail-enabled security groups in Office 365

Another update (11/19/2013):  further evolution of Office 365 services makes creation of distribution and security groups even easier, plus there's now an option of creating a dynamic distribution group (click here for more information):    Update (08/06/2012): a clear sign of Office 365 evolving along the same lines as other agile cloud services - small incremental features and minor new functionality are being delivered almost continuously and, unlike important major service updates,  without much fanfare. For example, there's no need to resort to using PowerShell to setup mail-enabled security groups anymore, it can now be done at creation using management portal:       Those managing Office 365 ( O365 ) tenant via the Microsoft Online Services Portal  ( MOS Portal ) interface would notice that there are two distinct group entities: Security Groups: can be created via MOS Portal (main portal page>Management>Security Groups) and used for assigning

Drumbeat - Sales and Technical Resources for Office 365

​ Drumbeat - provides information as well as technical and sales resources for Office 365. From partnering with Microsoft, to building up your sales and technical readiness, to adopting proven methodologies for successful deployment - you will find lots of good information and many helpful links there. Here's a quick sample of topics covered: The Customer Decision Framework is Microsoft's selling methodology designed to help partners sell Office 365 to their customers. Office 365 FastTrack is Microsoft's new, 3-step pilot and deployment methodology designed so customers experience service value early in the sales cycle with a smooth path to advance from a pilot to deployment.

Sample DS Command

PowerShell is all the hype these days, and rightfully so - you can do just about anything with it; but, call me old-fashioned I still like to use ds commands every now and then, it's quick and dirty. Here are a few samples that query AD and to get some basic counts and other information: # Get a count of enabled and disabled user accounts in the domain dsquery user -limit 0 domainroot | dsget user -dn -disabled | find /c /i " no" dsquery user -limit 0 domainroot | dsget user -dn -disabled | find /c /i " yes" # Get a count of enabled and disabled computer accounts in the domain dsquery computer -limit 0 domainroot | dsget computer -dn -disabled | find /c /i " no" dsquery computer -limit 0 domainroot | dsget computer -dn -disabled | find /c /i " yes" # Get a count of enabled, but inactive (at least 24 weeks) user and computer accounts in the domain dsquery user -inactive 24 -limit 0 domainroot | dsget user -dn -disabled | find /c /i