Skip to content
alunduil
Go back

Using rdiff-backup: Backup Remote Clients With Ease

Archival republish. From this blog’s Hakyll era; lightly copyedited.

Introduction

Backups are awesome! Unless you don’t have any. Also, it’s hard to find space for them and setting them up isn’t always fun. Without backups the day will come when we lose data and need to get it back and can’t. Whether it’s an accidental delete of the project you’ve been working hard on; a disk issue resulting in partial or complete data loss; or something completely different, data loss is only a matter of when, not if.

The Problem

Backing up clients behind NAT and other network obfuscation techniques adds another set of challenges to the equation. These can be solved by initiating them client side and having management set up around the idea of a data dump.

The Solution

rdiff-backup allows us to initiate backups from the client, use SSH as the communication protocol, keep incremental backups, &c.

Automating backups with rdiff-backup isn’t overly challenging but isn’t outlined (with required nuances). The magic lies in a little-known option, --remote-schema.

For example, the following Bash snippet is the cron entry (could be moved to a proper script) that backs up my laptop to a remote site (split across lines for readability):

/usr/bin/rdiff-backup \
--remote-schema 'ssh -i /home/alunduil/.ssh/backup_dsa %s rdiff-backup --server' \
--exclude-other-filesystems \
--print-statistics \
/home/alunduil \
daneel.alunduil.com::elijah-backup && \
/usr/bin/rdiff-backup \
--remote-schema 'ssh -i /home/alunduil/.ssh/backup_dsa %s rdiff-backup --server' \
--remove-older-than 7D \
--force \
daneel.alunduil.com::elijah-backup

Breaking this down, we have a few things that require explanation:

Conclusion

Creating backup strategies for remote clients with rdiff-backup is quite easy. This solution is ideal for mobile and spottily connected clients like laptop machines that might not be able to phone home for a variety of reasons.


Share this post on:

Previous Post
How I Read