Creating backups of running VMs in XenServer

With XenServer it is possible to create backups of VMs, even if they are running. The process is as follows:

Search for the uuid of the VMs to backup

First look for the uuid of the VMs to backup. We don’t want to backup the control domain itself, so we add is-control-domain=false to the vm-list command:

xe vm-list is-control-domain=false

Create a snapshot of each (running)

Now we create a snapshot of the VMs we want to backup, replacing the uuid one by one with the ones we found with the previous command. Also replace the name of the snapshot if desired:

xe vm-snapshot uuid=8d6f9d81-95b5-2ffb-4ecc-b5e442cc5c22 new-name-label=gb-r7n2-snapshot

This command has a return value: the uuid of the created snapshot. Then we transform the snapshot into a VM to be able to save it to a file, replacing uuid with the return value of the previous command:

xe template-param-set is-a-template=false ha-always-run=false uuid=4efd0392-8881-176c-012e-a56e9cb2beed

Save the snapshot to file

In the next step we save the snapshot to a file, replacing uuid with the snapshot uuid and providing a meaningful filename:

xe vm-export vm=4efd0392-8881-176c-012e-a56e9cb2beed filename=gb-r7n2-snapshot.xva

Remove the created snapshot

In the final step we delete the snapshot:

xe vm-uninstall uuid=4efd0392-8881-176c-012e-a56e9cb2beed force=true

Source: http://www.jansipke.nl/creating-backups-of-running-vms-in-xenserver/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.