Skip to main content

Obnam

Obnam is one of the two backup programs in my list which I highly recommend. It offers snapshot backups (in the spirit of btrfs snapshot subvolumes), data de-duplication across files and backup generations, and optional GnuPG encryption. Archers can get it on the AUR, and Debilians may obtain the current version from the developer's repository.

Obnam is ridiculously easy to configure and use:

[config]

repository = sftp://blackvelvet/bam/backup/nb_snapshot/deepgreen/

keep = 7d,4w

lru-size = 1024
upload-queue-size = 512

log = /home/cobra/.obnam/logs/default.log
log-level = warning
log-max = 10mb
log-keep = 10
log-mode = 0600

exclude = \.cache$, \.thumbnails$, \.tmp$, /cache/, /Downloads/, /temp/, /Trash/, /VirtualBox VMs/, /wuala/

Save this file as ~/.config/obnam/default.conf, for example, modify it to your needs, and execute obnam either directly

obnam --verbose backup $HOME

or via a small shell script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/bash

notify-send "Backup started, please be patient..."

obnam backup $HOME

if [ "$?" -ne 0 ]; then
  notify-send "Unable to complete backup."
    exit 1
else
  notify-send "Backup successfully completed."
fi

On my notebooks, I run this script manually, but on my desktops, I've added an entry to my crontab:

0    7-23  * * *   /home/cobra/bin/backup.obnam

The cron daemon sends a mail to report what has happened:

Date: Fri, 29 Aug 2014 09:01:11 +0200 (CEST)
From: "(Cron Daemon)" <cobra@blackvelvet.localdomai>
To: cobra@blackvelvet.localdomain
Subject: Cron <cobra@blackvelvet> /home/cobra/bin/backup.obnam

Backed up 77 files (of 187140 found), uploaded 63.0 MiB in 1m9s at 934.9 KiB/s average speed

That's a snapshot of my desktop with a total backup volume of 42 GB. Without the two lines in the config customizing the lru- and upload-queue sizes, a snapshot takes about 10 min, i.e., nine times longer. This mediocre performance with the default settings is certainly one of the reasons for the numerous reports of obnam being nice but slow. The speedup obtained by changing these settings, however, depends on your hardware: on the Mini, obnam is CPU limited, and it takes 90 s for one snapshot (of 5 GB size) no matter what the lru- and upload-queue sizes.

Restoring data is as easy as creating the backup. You can simply mount the backup, like that:

obnam mount --to /bam/obnam_mnt/

and access the resulting read-only filesystem with anything you like. Nice.

Contents © 2018 Cobra · About · Privacy · Powered by Nikola · Creative Commons License BY-NC-SA