Installation

_$: apt-get install obnam

In Ubuntu < 14.04 (or to install the latest version):

_$: apt-get install python-software-properties
_$: add-apt-repository -y ppa:chris-bigballofwax/obnam-ppa
_$: apt-get update
_$: apt-get install obnam

Crash course

Create a backup:

_$: obnam backup <dir>

Restore a backup:

_$: obnam mount --to <dir>      # Do not forget: fusermount -u <dir>
_$: obnam restore --to <dir>

Restore a file from a backup:

_$: obnam restore --to <dir> <file path>

List all backups:

_$: obnam generations

List all files:

_$: obnam ls

Remove unnecessary backups:

_$: obnam forget --keep=30d

Delete a lock file

If a lock file remains after a failed run, the following attempts to create a backup will also fail while trying to create the lock file. This appears in the log in a message like LockFail: R681AEX: Couldn't create lock ./lock: timeout

To delete that file:

_$: obnam --config obnam.conf force-lock

Test

Create files and directories

_$: mkdir -p dir/{a,b,c}
_$: for d in ./dir/*
do
    tr -dc A-Za-z0-9 < /dev/urandom | head -c 8 > $d/f
    printf "$d/f: %s\n" $(cat $d/f)
done

Backup #1

obnam.conf:
-----------
[config]
repository = ./dir.obnam
log = ./obnam.log
_$: obnam --config obnam.conf backup ./dir

Simulate failure

_$: for d in ./dir/*
do
    echo "CORRUPT" > ${d}/f
done

Backup #2

_$: obnam --config obnam.conf backup ./dir

Difference among generations

_$: obnam --config obnam.conf diff 2 5      # After the diff, write first the oldest generation and then the newest
* .../a/f
* .../b/f
* .../c/f

Restore backup #1

_$: obnam ls --config obnam.conf
Generation 5 (2015-01-14 10:28:20 - 2015-01-14 10:28:20)
...
_$: obnam --config obnam.conf generations
2	2015-01-14 10:03:20 .. 2015-01-14 10:03:20 (12 files, 24 bytes)
5	2015-01-14 10:28:20 .. 2015-01-14 10:28:20 (12 files, 24 bytes)

The backup made at 10:03 contains the original files and the backup made at 10:28 the corrupt ones. Therefore we have to restore the 10:03 backup, which is in the generation 2.

_$: mkdir restore
_$: obnam --config obnam.conf mount --generation 2 --to ./restore
_$: less restore/home/<user>/testing/obnam/dir/a/f      # Check that a random 8 length string appears
_$: fusermount -u ./restore