Ever wanted to do full backups of your vms running in xenserver free edition?
Sure you can export them as backup, but in order to do so you would need to power them down.
After some digging around in the command and reading several forum threads etc…
Now I’ve been using this method for quite a while and it has proven working and successful.
First of all we will need to make the USB disk useable to the system, in order to do so connect the disk to the server and log on to the server using the local console or remote shell
To view the disks connected to the system enter
fdisk -l (yes that’s an L)
Then see if your disk is listed , probably something like /dev/sda(but could be sdb/c/etc…)
Now we must partition the disk.
fdisk -l (yes L) /dev/sda
if there are any partitions , delete them by pressing d
Now press n for new partition, then p for primary
Then press w to save changes
So now we must format the partition so there is a valid filesystem for the system to use.
mkfs.ext3 /dev/sda1 (this may take a while depending on the disk size)
Now that we have a valid and useable disk to perform our backups on, it’s time to make the disk available to the system.
to do so:
mount /dev/sda1 /mnt/<xednbackupfolderyoucreated>
From here on the disk is ready to be used, so we’ll skip to the fun part, the actual backups.
To fully backup(export) a live VM we need to snapshot–>convert snapshot to “vm”–>export the “vm” –>cleanup
1 Snapshot the machine, this can be done by the shell or xencenter, whatever you prefer.
The following is all SHELL!!!
2 Identify the snapshot you just made:
this will give you a list of snapshots, note the UUID for the needed snapshot.
3 Marking the snapshot as a “vm”
xe snapshot-param-set is-a-template=false uuid=<UUID of the snapshot>
4 Exporting the vm
xe vm-export vm=<name of the snapshot you converted> filename=/mnt/xenbackupfolder/filenameyoulike.xva
The export will take a while, depending on the size of the vm.
You can monitor the progress in xencenter by selecting your xen host in the left pane and then clicking the “log” tab.
after the export is complete you may delete the snapshot.