User Tools

Site Tools


virtualization:xenserver:xenserver_backup_cli

This is an old revision of the document!


Creating Backups of Running VMs in XenServer (XCP)

FIXME Needs testing and updating

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

  1. Search for the uuid of the VMs to backup
  2. Create a snapshot of each (running) VM
  3. Save the snapshot to file
  4. Remove the created snapshot

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 and we also don’t want backups of snapshots so we add is-a-snapshot=false:

xe vm-list is-control-domain=false is-a-snapshot=false

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=<uuid of VM> new-name-label=<snapshotname>

:!: Note the return value (the uuid of the created snapshot).

Then we transform the snapshot into a VM to be able to export it to a file. Replace the uuid with the return value of the previous command:

xe template-param-set is-a-template=false ha-always-run=false uuid=<uuid of snapshot>

In the next step we export the snapshot to a file. Replace the uuid with the snapshot uuid and provide a meaningful filename:

xe vm-export vm=<uuid of snapshot> filename=/path/to/filename.xva

In the final step we delete the snapshot:

xe vm-uninstall uuid=<uuid of snapshot> force=true
virtualization/xenserver/xenserver_backup_cli.1365786727.txt.gz · Last modified: 2013/04/12 11:12 by 127.0.0.1