<!-- 
.. title: Obnam
.. slug: obnam
.. date: 2014-08-31 14:35:20 UTC+01:00 
.. tags: linux, backup, 
.. link: 
.. description: 
.. type: text 
--> 

[Obnam](http://obnam.org/ "Obnam") is one of the two backup programs [in my list](better-backup.html "Obnam") which I highly recommend. It offers snapshot backups (in the spirit of [btrfs](butter-bei-die-fische.html "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.](http://obnam.org/download/ "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](http://bastian.rieck.ru/blog/posts/2013/backups_with_obnam/ "small shell script"):

	#!/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.localdomain
	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,](http://listmaster.pepperfish.net/pipermail/obnam-support-obnam.org/2014-June/003086.html "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](http://blog.karssen.org/2013/01/04/comparing-rsnapshot-and-obnam-for-scheduled-large-backups/ "slow"). The speedup obtained by changing these settings, however, depends on your hardware: on the [Mini](turbo.html "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.

