Table of Contents

Backupninja with unattended rdiff-backup

Backupninja provides a centralized way to configure and schedule many different backup utilities. It allows for secure, remote, incremental filesytem backup (via rdiff-backup), compressed incremental data, backup system and hardware info, encrypted remote backups (via duplicity), safe backup of MySQL/PostgreSQL databases, subversion or trac repositories, burn CD/DVDs or create ISOs, incremental rsync with hardlinking.

This walkthrough will describe how to setup Backupninja together with rdiff-backup in unattended mode.

The two partners in this setup are server.example.net and backup.example.net. The former should backup its data nightly to the latter. The user service will be the backup system account using password-less ssh access. The target directory is /data/backup, so the complete backup target address in ssh notation is service@backup.example.net:/data/backup.

backupninja_overview

Setup: Once

target: create system user

backup.example.net:~$ useradd -m service 
backup.example.net:~$ passwd service 
                      # ^^ only required for copying over ssh public identities; can be disabled later: 
                      backup.example.net:~$ passwd --lock service

target: install backup software

rdiff-backup requires pyxattr >=0.4 (looks like)

Setup: For each backup pair

target: setup backup destination

backup.example.net:~$ mkdir -p /data/backup/{customer}/server.example.net/rdiff 
backup.example.net:~$ chown -R service:service /data/backup/{customer}/server.example.net/rdiff

source: setup backup source

Just the hour-part of “when” is actually used, so this will run at 00:00! This is due to a limitation (bug?) in backupninja.

Properly configure each handler!

TODO: Write more e.g. about using slapcat for LDAP.

Prerequisites

target: prepare backup partition (optional)

hypervisor is the machine backup.example.net is running on. We'll mount another partition with plenty of backup space. Here's how (LVM + Xen):

backupninja_vm

hypervisor:~$ lvcreate -L 250G vg0 -n backup-data 
hypervisor:~$ mkfs.ext3 /dev/vg0/backup-data 
 
hypervisor:~$ nano /etc/xen/backup.example.net.cfg
/etc/xen/backup.example.net.cfg
... 
disk        = [ 
                  ... 
                  'phy:vg0/backup-data,sda6,w', 
              ] 
...
backup.example.net:~$ mkdir /data 
backup.example.net:~$ nano /etc/fstab
/etc/fstab
... 
/dev/sda6 /data    ext3 noatime,nodiratime,errors=remount-ro 0 1
backup.example.net:~$ halt 
hypervisor:~$ xm create /etc/xen/backup.example.net.cfg

target: configure backup directory

Exclude backup path from being scanned by “locate” & Co.:

backup.example.net:~$ nano /etc/updatedb.findutils.cron.local 
PRUNEPATHS="/data/backup"