XenServer Backup Options

By CMD Technology Group

7 min read

Recently, we have been asked several times about backing up XenServer Virtual Machines (VMs). At first, this struck us as odd because some of the people who asked have had a XenServer environment for a significant amount of time. Why didn’t they already have a backup solution in place?

As it turns out, they were looking for something different. Primarily they were looking for a single backup solution that encompassed all their backup needs. With that in mind, we can look at what is out there. In discussing solutions, this will not be a comprehensive list. So, if we do not include a solution, it is not because we are devaluing it. If you know of a solution, and you would like to point it out, please post it in the discussions along with a description of the product and what you like about it.

Types of Backups

Citrix (and others) categorize XenServer Virtual Machine backups into three types; Cold, Warm, and Hot backups. These are also terms for disaster recovery and high availability, but they take on a slightly different meaning when referring to XenServer backups. 

Cold and Warm backups refer to backups that cause service interruption. A cold backup occurs when the VM is powered down entirely. A Warm backup will not power down the VM but can still interrupt service while the VM is being backed up. And a Hot backup? You guessed it, is one that will not disrupt service and keep the VM running. However, note that the performance of the VM may be affected during a Hot backup, but the VM will still be able to respond to requests.

Backing Up the XenServer Host

We have found very little need for a purchased solution to back up XenServer Hosts. The metadata on a host rarely changes, and to install XenServer on a server takes only a few minutes. Therefore, all that is needed is to backup the metadata for the host from time to time. 

One way to accomplish this is through command line tools. Backing up a host server needs the ‘xe host-backup’ command. To restore a host server, it takes a few steps. First, install XenServer and run the ‘xe host-restore’ command using the file created from the backup command. Then, you will need the XenServer install CD to run a ‘Restore from Backup’. This can be scripted and works fine for individual hosts, but most times, we have a pool of multiple hosts. You can still use the commands we discussed, to make a host backup, but you need to use the ‘xe pool-dump-database’ command to back up the pool metadata. You would then use the ‘xe pool-database-restore’ command to restore the pool metadata. Again, scripting can help with these tasks. For those more comfortable with a GUI, here are the steps for backing up a pool database through XenCenter:

  • In the XenCenter Navigation pane, click Infrastructure, and then click on the pool.

  • Click the Pool menu and then select Export Resource Data. 

  • Browse to a location where you would like to save the report and then click Save.

BASIC XenServer VM Backup Options

For immediate needs, you can export a VM, take a snapshot, or utilize existing server backup technology. Exporting a VM and taking snapshots can be automated, but neither of them are true backup solutions providing resolution to backup strategies. It is highly recommended to view snapshots as a temporary solution, not a full backup strategy. Snapshots are categorized as a Hot Backup. Snapshots will eat up your storage very quickly. So will virtual machine exports. One cheap method of backup is to take a snapshot of a running VM, export the snapshot to an .XVA file, and then delete the snapshot. Besides from storage utilization issues which get worse in large or growing environments, there are many other drawbacks to this method like automation problems, file level restoration complications, retention over time/restore point tracking, etc.

The metadata for a VM contains information about the VM (such as the name, description, and Universally Unique Identifier (UUID)), VM configuration (such as the amount of virtual memory and the number of virtual CPUs), and information about the use of resources on the host or resource pool (such as Virtual Networks, Storage Repository, ISO Library, and so on). Most metadata is written when the VM is created and is updated if changes are made to the VM configuration. This means that it is not always necessary to perform daily exports of all the VM metadata. 

Exporting or importing metadata can be done from the text-based console menu. On the physical console, this console menu is loaded by default. The following steps will export the XenServer metadata:

  • To start the console menu through the host console screen in XenCenter, type xsconsole from the command line.

  • Select Backup, Restore, and Update from the menu. 

  • Select Backup Virtual Machine Metadata. 

  • If prompted, log on with root credentials. 

  • Select the Storage Repository where the VMs to be backed up are stored. 

  • After the metadata backup is done, verify the successful completion on the summary screen. 

In XenCenter, on the Storage tab of the Storage Repository (SR) selected in step 3, a new VDI should be created named Pool Metadata Backup.

To restore the metadata in a DR environment, the metadata must be imported. A prerequisite of running the import command in the DR environment is that the Storage Repository on which the replicated virtual disk images are located are set up and re-attached. The Virtual Networks must also be set up correctly by using the same names in the production and DR environment.

After the SR is attached, the metadata backup can be restored. From the console menu:

  • Select Backup, Restore, and Update from the menu.

  • Select Restore Virtual Machine Metadata.

  • If prompted, log on with root credentials.

  • Select the Storage Repository to restore from.

  • Select the Metadata Backup to be restored.

  • Select to restore only VMs on this SR or all VMs in the pool.

  • After the metadata restore is done, verify the summary screen for errors.

  • The VMs are now available in XenCenter and can be started at the new site.

ADVANCED Backup Options

3rd party backup solutions generally fall into one of three categories: backups done through storage replication, backups performed at an OS level, and backups performed using snapshots through the XenAPI. 

Backups done through storage replication utilize the replication abilities built into your backend storage (SAN or NAS). The VMs stored on your SAN or NAS get replicated to another site by the storage device. This is both a backup and disaster recovery option. However, it is probably the most expensive option because it requires two or more storage devices in different geographical locations with a pipe between them big enough to support the replication traffic. File level restoration becomes a problem because the VM as a whole is replicated without a way to parse data inside the VM.

Backups done at the OS level is the longest running method of backing up a server. Even though these are virtual machines, they are still fully functional servers. The hardware they run on is different; the differences are the drivers used. The OS is still the same. You can use your traditional backup software which usually (not always) places an agent in the OS to perform backups of the server system state, data, and files. This could be solutions from Symantec, Carbonite, Acronis, ComVault, and hundreds of other backup vendors. For those of you with smaller Windows server VMs and wanting to save money, you can even employ Windows Backup which comes with Windows. 

OS level backups is a method in which you can keep from using multiple solutions providers and will provide the most granular level restore options for the OS, applications, and services. One solution will probably handle it all. However, you will be restoring a server the same way you would a physical server. Fix the hardware, install the OS, install the backup agents as needed, and then restore. This is a significant differentiation from solutions geared towards backing up virtual machines as a whole image because they enable you to restore a VM to its state at the time of backup without rebuilding the server. 

Backups done through snapshots utilizing the XenAPI is a common form of backup for a XenServer. This method backs up the server as a whole image. Many solutions use this method. You can find free premade scripts people have posted that will perform this function for you. You just won’t get any bells and whistles with a script. And that is what differentiates the 3rd party backup solutions over just getting a script. The bells and whistles 3rd party vendors include catalog and sort options, give broader control over the storage being used, offer deduplication, and many other features. Some of these solutions have features that will mount the snapshot to allow you to perform granular recovery.

Unitrends acquired PHD Virtual, which was one of the first well rounded support offerings for XenServer. Over the last few years, it has grown to allow you to do granular level restores even for SQL, Exchange, and SharePoint. Quadric Alike is a well-rounded solution. Its product trial is a free version for one XenServer that does not expire. So, if you are a small shop with only one XenServer, here is a good free solution. Many solutions, like Carbonite, offer cloud backup services. These solutions allow backup to local disk and then transfer that backup to the cloud. You can decide how long you wish to keep the local backups independent and how long you want to keep the cloud backups. You could backup directly to the cloud, but experience has shown that this is a slower method, particularly if you do not have the bandwidth to support the solution. Backing up locally keeps you in your backup window and then copying that backup to the cloud can occur outside of the backup window.

Ideally, a solution that provides both OS level and virtual server backup with a granular level restore are what a lot of administrators seek. It would be your single backup product that covers both physical and virtual worlds. SEP Software Corp offers such a solution as well as Symantec NetBackup. Many of these solutions started as a standalone product which was incorporated into a package or integrated into another solution.

There are many other solutions to look at. If you would like to offer a suggestion We did not mention; please do so in the comments below.

afernandez@cmdtg.com | 407-442-0265

If you have a question about any of our solutions or any feedback you’d like to share, contact us. We would love to hear from you!

Get in touch

You can email us at afernandez@cmdtg.com

Give us a call at 1-800-806-4173

Or contact us using the form below