I have a desktop computer at home with ~1TB of disk space running Debian Linux. With the help of Duplicity I automated an incremental backup of the files in the HOME directory of my Mac Book Pro which I use to do most of my work at home and on the go.

Usually, Duplicity is used to do cloud backups (Amazon S3, Dropbox…), but I don’t have a decent enough internet connection to make this practical. Besides that I don’t want to spend money on ~300GB of cloud storage.

Quick HOWTO

Install Duplicity on the Mac OS X system using Homebrew.

$ brew install duplicity

You will be convinced of the power of Duplicity by running duplicity --help | less and checking all the supported protocols and handy command options (check man duplicity for option details).

On the Debian Linux server, create the directory for the backups

$ mkdir ~/Backups

You should have a SSH+SFTP installed and properly configured on the Debian Linux server.

I placed my backup command in a script to make it easy to use. You should make the proper changes for your own setup.

~/bin/duplicity.selected.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 #!/bin/sh

ulimit -n 1024

NAME=macbook_home
EXCLUDE_FILELIST=/Users/felipe/duplicity_exclude
FROM=/Users/felipe
TO=sftp://felipe@hobbes//home/felipe/Backups

duplicity $1 $2 \
  --no-encryption \
  --name=$NAME \
  --exclude-other-filesystems \
  --exclude-filelist=$EXCLUDE_FILELIST \
  --progress \
  $FROM \
  $TO

You can exclude files and folders from the backup by listing them in the $EXCLUDE_FILELIST file.

Give permission of execution (chmod +x ~/bin/duplicity.selected.sh) and debug it with ~/bin/duplicity.selected.sh --dry-run. With the --dry-run option, Duplicity will simulate everything but won’t actually backup anything. Once you’re sure everything works you can finally perform the actual backup.

$ ~/bin/duplicity.selected.sh
Reading filelist /Users/felipe/duplicity_exclude
Sorting filelist /Users/felipe/duplicity_exclude
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
No signatures found, switching to full backup.

When it runs for the first time, a full backup is performed. In later executions it automatically performs an incremental backup. You can run ~/bin/duplicity.selected.sh full to force a full backup if you want.

According to man duplicity, duplicity $TO $FROM should be enough to restore the backup once you need it. Check the man page for backup restore details.