Logiciel Libre

April 22, 2007

Home Backups

Filed under: Default — Tags: — adam @ 8:00 am CDT

My data is important. Enough so that I’ve hemmed and hawed for quite a while over the best automated backup solution. I started out with tar, then moved on to rsync. Now I’m keen to rsnapshot. Here’s a Zod-focused guide to setting it up.

Installation

$ sudo yum install rsnapshot

Sweet.

Configuration

Here’s /etc/rsnapshot.conf:

config_version 1.2 # a second local hard drive is mounted at /backup snapshot_root /backup/snaps cmd_cp /bin/cp cmd_rm /bin/rm cmd_rsync /usr/bin/rsync cmd_logger /usr/bin/logger cmd_du /usr/bin/du cmd_rsnapshot_diff /usr/bin/rsnapshot-diff interval hourly 4 interval daily 7 interval weekly 4 interval monthly 3 verbose 2 loglevel 3 logfile /var/log/rsnapshot.log lockfile /var/run/rsnapshot.pid link_dest 1 exclude /backup exclude /dev exclude /lost+found exclude /media exclude /mnt exclude /proc exclude /sys exclude /tmp exclude /var/cache/yum/* backup / localhost/ # vim: ft=config noet nosta

(the whitespace must be tabs, not spaces)

I also created a log rotation config file, /etc/logrotate.d/rsnapshot:

/var/log/rsnapshot.log { missingok notifempty }

Testing

$ sudo rsnapshot configtest Syntax OK $ sudo rsnapshot -t hourly # ...snipped... # (worked) $ sudo rsnapshot hourly # (worked)

Done. Ready to add this thing to root’s crontab.

# 4 hourly backups a day (once every 6 hours, at 0,6,12,18) 0 */6 * * * rsnapshot hourly # 1 daily backup every day, at 11:50PM 50 23 * * * rsnapshot daily # 4 weekly backups a month, at 11:40PM, on the 1st, 8th, 15th, and 22nd 40 23 1,8,15,22 * * rsnapshot weekly # 1 monthly backup every month, at 11:30PM on the 1st day of the month 30 23 1 * * rsnapshot monthly

Pros

  • bundled with Fedora Core 6
  • FLOSS (of course)
  • simple and maintainable
  • fast (enough): hourlies take about 3min to run
  • training, setup time seemed reasonable
  • nicely automated, set and forget (hopefully)
  • efficient use of disk space, no compression needed

Cons

  • can’t just say “backup /”. Special dirs like /proc and /sys must be avoided
  • can’t use backup to create a new bootable disk (although I’d probably want to rebuild rather than restore, anyway)
  • no compression (but I don’t currently need it)
  • no encryption (but this is just a local backup, DIBS will probably be used for remote, encrypted backup)
  • extra work must be done to back up MySQL databases, bdb-backed Subversion repositories, etc. (but backup scripts are supported by rsnapshot)

All of the cons are simply due to lack of features. However, the features that are included work quite well!

One other thing I’m not sure of is if/how rsnapshot recovers from crashes.

Other reading material:

1 Comment »

  1. Have you checked out unison? I don’t know whether it’s really suited to what you’re looking at or not or any better or worse than rsnapshot, but I’ve used it before and been happy with it and it’s nicely cross-platform (or appears to be - I’ve only used it between Windows machines). Ever since setting up my almost-a-terabyte RAID array, perforce, and keeping all my mail in IMAP, I’ve mostly stopped worrying about backups, though.

    Comment by Patrick — April 24, 2007 @ 7:59 pm CDT

RSS feed for comments on this post.

Leave a comment

Powered by WordPress