Import/Restore gzipped XVA archives from the command line

If you’re like me – you value space over backup run time and are using compression with your NAU XenServer backup scripts. I”m working on more concrete numbers, but safe to say that on a small scale test of some lightly used services, we see a 45% reduction in XVA backup size with compression allowing us to keep additional days in hot storage. The only catch is that out of the box, XenServer doesn’t import the gzipped files directly from the command line or from Xen Center. To get around this, we simply use this single line to unpack the XVA file and pipe it into our vm-import command:

gunzip -c /snapshots/vm_backup.xva.gz | xe vm-import sr-uuid={SR-UUID} filename=/dev/stdin

This assumes a couple of things to work:

  • That you have a backup to restore.
  • That the XenServer installation wasdn’t lost or was already reinstalled.
  • That you’ve restored the mount point to where you’re storing the backups.
  • That you know your SR UUID – bonus hint: try xe sr-list.

In the initial testing – I haven’t had a big enough difference in restoration time that would sway me to go back to uncompressed XVA backup files.  And remember, it’s just like they say in the forums – it’s not a backup if you haven’t tried restoring it.