Skip to main content

Backup again

Here at home, I'm extremely happy with rsnapshot as a backup solution. It's exactly what I need: easy to configure (with just a few pitfalls), totally transparent, and very reliable. Too bad I can't use it at work: the incremental backups of rsnapshot rely on hard links, which are supported neither by cifs nor by sshfs. And no, I do not want a server-based (pull) backup. I want to push my data!

We briefly thought about setting up nfs, but that requires kerberos for secure authentication ... oh well, that's really too much hassle for a lonely snake. I instead decided to search an easy-to-use backup program which does not require hard links. Easy to use, mind you: enterprise-class solutions of the like as bacula or amanda are explicitely ruled out.

And I think I found one: rdiff-backup, which realizes incremental backups via rdiff.

The configuration is simple:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash

# http://www.gnu.org/savannah-checkouts/non-gnu/rdiff-backup/examples.html
# http://wiki.rdiff-backup.org/wiki/index.php/Main_Page
# http://wiki.rdiff-backup.org/wiki/index.php/BackupToSshfsMount
# http://en.kioskea.net/faq/sujet-746-rdiff-backup-making-effective
  -and-incremental-backups

# Be nice to the hard disk
ionice -c3 -p$$

# Some variables
source="/home/cobra" # directory being backed up
destination="/mnt/home/rdiff" # directory backing up to
excludelist="/home/cobra/bin/exclude_from_backup.txt"

# Mount home (check your local uid and gid with id)
sshfs username@server:/home/users/username /mnt/home \
-o workaround=rename,uid=local_uid,gid=local_gid

# Checking for old backups that need to be removed
echo "Removing backups older than one month"
rdiff-backup --remove-older-than 30D --no-hard-links --force $rdestination
# For a list of the number and date of incremental backups, use:
# rdiff-backup -l $destination

# Start the backup
echo "Starting backup"
nice -n +15 rdiff-backup --print-statistics --no-hard-links --exclude-sockets \
--exclude-filelist $excludelist $source $destination
echo "Backup complete"

# Unmount home
fusermount -u /mnt/home

The exclude list might look like that:

/home/cobra/.beagle/
/home/cobra/.Mail/FalseNegs/
/home/cobra/.Mail/Junk/
/home/cobra/.Mail/Worms/
/home/cobra/.Mail/trash/
/home/cobra/temp/
/home/cobra/tmp/
/home/cobra/.opera/cache4/
/home/cobra/.opera/images/
/home/cobra/.mozilla/firefox/ytuudeoq.default/Cache/
/home/cobra/.VirtualBox/
/home/cobra/VMWare/

I've just started to use it, but so far it looks very promising. Ask me again in 30 days. :)

What I will detail very soon in a forthcoming blog entry: how to automate this backup in the most convenient way.

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