An Introduction to rsnapshot

Initial Options

There are a number of reasons to backup your data, and for as many reasons, there are options.

Rsync is one of the popular options, though some would say rsync alone would not be a true backup (as it’s just data mirroring).

Two popular programs that utilize rsync as their backbone are rdiff-backup and rsnapshot, after some internal deliberation I’ve decided to go with rsnapshot.

rsnapshot keeps everything, in full-size, but with hardlinks (so multiple copies of the same file won’t take up more than one copy) for however many intervals you decide.

Initial Inept Strategy

My initial plan was to get two external hard drives, connect them and run a grsync myself (with two different profiles).

I had to do all this when I remembered to, and since I don’t like desk clutter (in real life), I had to get the externals hard drives out of the closet along with their USB & power cables which had to be attached.

I had to do work for backups that weren’t rotating. Pfft.

Better But Fallible Strategy

I already said I don’t want to do anything for backups, so I installed rsnapshot instead since it’s quite good at automation when used with cron, plus the drives are permanently attached to aramaki so I really don’t have to be involved.

I still have two drives though, and because of how rsnapshot uses the backup directory I can’t have a single rsnapshot configuration write to both external drives. I’m using two different configurations, which is quite easy with rsnapshot -c /path/to/configuration.file.

I have cron run at different intervals for each configuration file, for most of my video files I only keep a few weekly intervals, and for everything else (pictures, music, other video, personal stuff) I get a bit more frequent:

#m       h      dom     mon     dow     command

#other backup, ran quite frequently
#snapshot_root set to /srv/rsnapshot/other
00     */4     *       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-other.conf hourly
30     3       *       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-other.conf daily
00     3       *       *       0       /usr/bin/rsnapshot -c /etc/rsnapshot-other.conf weekly
30     2       1       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-other.conf monthly

#video backup, only run once a week
#snapshot_root set to /srv/rsnapshot/video
00     01      *       *       1       /usr/bin/rsnapshot -c /etc/rsnapshot-video.conf weekly

You can bring up root‘s cron file with sudo crontab -e.

Note that this current setup fails horribly if my house catches on fire. Though I like to think that I’ll rip the two externals out of the closet on my way out the door.

I could spend a few bucks and get a small online backup service running, the completely irreplaceable stuff is only about 20GBs of data, I could–very annoyingly–rebuild everything else.

Improvements

If I had to do it differently I’d buy a third drive for personal data, and run something like this:

#m       h      dom     mon     dow     command

#other backup, ran quite frequently
#snapshot_root set to /srv/rsnapshot/personal
00     */4     *       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-personal.conf hourly
30     3       *       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-personal.conf daily
00     3       *       *       0       /usr/bin/rsnapshot -c /etc/rsnapshot-personal.conf weekly
30     2       1       *       *       /usr/bin/rsnapshot -c /etc/rsnapshot-personal.conf monthly

#video backup, only run once a week
#snapshot_root set to /srv/rsnapshot/video
00     01      *       *       1       /usr/bin/rsnapshot -c /etc/rsnapshot-video.conf weekly

#media backup, only run once a week
#snapshot_root set to /srv/rsnapshot/media
00     02      *       *       1       /usr/bin/rsnapshot -c /etc/rsnapshot-media.conf weekly

Of course the next step will probably just be getting another computer that stays powered-off, with another computer setup to send a magic packet with cron to wake up, perform a backup and turn back off to keep power consumption down.