Skip to content

How to Backup Xen Orchestra

Attention

As of 8/22/21, I'm no longer using XCP-NG. This information is being left as reference material, but should be considered outdated and/or inaccurate.

Summary

As of 3/27/20, Xen Orchestra is now running on a Raspberry Pi 4 with a static IP of 192.168.1.60.

This article details the steps taken to setup an incremental backup of Xen Orchestra to the Synology NAS. A cron job has also been configured with notifications setup with healthchecks.io.

Mount NAS to RasPi

In order to backup to the NAS, the following was done:

  • Change directory to /mnt
  • Make a backups directory
sudo mkdir backups
  • Create an entry in the fstab folder
# Diskstation
192.168.1.6:/volume1/Xen-Backups/XOA    /mnt/backups    nfs     defaults        0       0
  • Confirm there are no errors
sudo mount -a

Configure Backup

  • Clone the backup script
cd ~
git clone https://github.com/lzkelley/bkup_rpimage.git
  • Change into the Git directory
  • Make an initial backup using the following command:
sudo sh bkup_rpimage.sh start -c /mnt/backups/rpi_backup.img

The initial image took ~15 mins, but was successful.

Setup Automatic Backups

In order to setup automatic backups, a cron job can be leveraged to make this happen. For this, the crontab editor will be used and will accomplish the following:

  • Incremental Backup
  • Runs daily at midnight
  • Sends an alert to healthchecks.io if the job fails for any reason after a 60 minute grace period.

Open crontab with the following command:

sudo crontab -e

In the crontab editor, add the following syntax:

0 0 * * * sudo sh /home/xenadmin/bkup_rpimage/bkup_rpimage.sh start -c /mnt/backups/rpi_backup.img && curl -fsS --retry 3 https://hc-ping.com/36d4e296-dbcb-4a11-8c89-0cbebb2f3876 > /dev/null

Reference