Create Daily RHEVM Backups

By | 2015/08/20

Create Daily RHEVM Backups

RHEV out of the box does not provide any backups for the RHEV Manager, or RHEVM. However, you can script up a daily backup of RHEVM. Check it out!

1. First, ssh into rhevm and make a backup directory

sudo mkdir /var/lib/ovirt-engine-backups/

2. Next, create the following file and use my script as a general guide.




#!/usr/bin/env bash
# See
/usr/bin/engine-backup --mode=backup --scope=all --file="/var/lib/ovirt-engine-backups/engine-backup-$(hostname)-$(date +%F).tar.bz2" --log=/var/log/ovirt-engine-backups.log

# (Optional) rsync backup to some other host for long term storage
# /usr/bin/rsync -azv -e ssh /var/lib/ovirt-engine-backups/*.bz2$(hostname)/

# (Optional) rm backups older than 7 days | keep 7 days of backups local
find /var/lib/ovirt-engine-backups/ -name "*.bz2" -mtime +7 -exec rm -rf -- {} \;

3. Make that file executable

sudo chmod +x /usr/local/bin/

4. If desired, run the script manually to make sure all works ok.

sudo /usr/local/bin/

5. Finally, edit root’s crontab and make an entry for this script to run daily.

sudo crontab -e
# rhevm backup run daily at 02:30
30 2 * * * /usr/local/bin/ >/dev/null 2>&1