Hot backup, running virtual machines using XenServer API.
Without further ado, this brief description is not the most complex but highly sought-after feature.
1. Preparing storage for backups
First we need to choose a place to store backups. This can be a local drive, external drive, network share. In a word, all that you can mount.
For example
mkdir /mnt/backup
mount -t cifs "//192.168.0.20/share" -o username=username,password=password /mnt/backup
2. Preparing Virtual Machines (Windows)
2.1 We put XenTools
2.2 XenTools provides VSS Provider (to use ShadowCopy), however it is not installed automatically with XenTools. In the folder with XenTools run install-XenProvider.cmd.
3. Setting up the script
The logic is quite simple:
Make a xe vm-snapshot-with-quiesce snapshot, if you can’t do it, use the usual vm-snapshot
Remove the flag template xe template-param-set is-a-template = false
We do export to the xe vm-export file
Remove unnecessary snapshot xe vm-uninstall
But I recommend using the ready-made
script from Andy Burton . All configuration via the config file, you can set a list of virtual machines for backup, backup only working or select all.
mkdir /home/backup
cd /home/backup
wget www.andy-burton.co.uk/files/xenserver_backup/xenserver_backup.tar.gz
tar -xzf xenserver_backup_3.0.tar.gz
chmod 700 vm_backup.*
nano vm_backup.log
Open vm_backup.cfg and set the necessary parameters (path for logs, backups, list of machines for backup and file name format).
Run vm_backup.sh
4. Possible problems
If all of a sudden you decide to use a network folder as windows 7 as a storage, then an unpleasant surprise can await you, due to errors in writing and mounting. But there is a solution
Set the following registry key to '1 ′:
HKLM \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Memory Management \ LargeSystemCache
and set the following registry key to '3 ′:
HKLM \ SYSTEM \ CurrentControlSet \ Services \ LanmanServer \ Parameters \ Size
Thanks Alan LaMielle
Another unpleasant surprise is the speed of writing to CIFS-mounted sections. For unknown reasons, XenServer 5.6 and XCP 1.1 are about 10 Mbit / s. However, there are no such problems with NFS and iSCSI. Perhaps it is conceived, or it's just a bug.
5. More options
An alternative would be to use third-party software, such as Symantec NetBackup. Citrix recommends it in his WHITE PAPER "Citrix XenServer: Virtual Machine Backup".