rdiff-backup is an utility capable of maintaining a back-up mirror of a file or directory over the network, on another server. It stores incremental rdiff deltas with the back-up, which allows you to recreate any back-up point. The back-up is encrypted through the SSH protocol, thus no one will be able to read the data being transferred. Moreover, rdiff-backup is saving bandwidth by making incremental back-ups.
Prerequisites
As for all back-ups, you should be planning what you want to do, before actually doing it. Next, you should make sure that both computers are reachable from the Internet (or at least the computer you want to back-up) and whether both computers have SSH (client and daemon) installed and configured properly. As an example for this guide, I'll back-up a directory on my work computer, to a directory on my home computer.
Installation
- First of all, you'll need to install rdiff-backup on both computers. This is a very popular utility so it's most likely to find it in your distribution's repository so use your package manager to install it. Eg:
Fedora:
Generate a DSA key pair on the home computer:
Send the public key to the work computer: (The work computer has to have used the ssh client, otherwise, the .ssh directory won't exist)
$ scp .ssh/id_dsa.pub [email protected]:~/.ssh
Actual back-up process
- What we want to do here is back-up the scripts/ directory on the work PC to the home PC. To do this, type the following command on the home machine:
- On the home machine, type the following command to open the crontab editor:
As of now, every night at 4:30, the scripts directory from the work PC will be saved to /home/home-user/scripts directory and will be updated if any scripts are added to the work directory.