วันพุธที่ 12 มิถุนายน พ.ศ. 2556

Creating backups of running VMs in XenServer

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=d61bfc1a-33b2-5406-7ea5-76e4f7113220 new-name-label=snapshotname
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=b759625c-eab5-4e0f-be5e-a05bcbad869a
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=b759625c-eab5-4e0f-be5e-a05bcbad869a filename=filename.xva
In the final step we delete the snapshot:
xe vm-uninstall uuid=b759625c-eab5-4e0f-be5e-a05bcbad869a force=true
http://www.jansipke.nl/creating-backups-of-running-vms-in-xenserver/