The syntax is similar to the "cp" command: the command itself, followed by the source directory, then the destination (backup) directory, like so:
rdiff-backup /home/jizldrangs /usr/backups
When using SSH, use the server name, followed by double colons and the absolute path, like this:
rdiff-backup /home/jizldrangs fileServerName::/home/jizldrangs/backups
As with many command-line tools, there are a lot of options, most importantly the option to include or exclude certain paths or files. See the examples and man page for details on how to fine-tune your backup.
I put this on my netbook and desktop, which are both running Ubuntu Maverick, but my wife's machine had only the sporadic backups I had made to our USB hard drive, and I wanted a more consistent plan. Fortunately, rdiff-backup, being a Python application, also has a Windows version. If you backing up to a local directory or mounted network drive, you are good to go.
If you want to back up over SSH, it gets a little sticky but it can be done. Using the instructions on this post I downloaded plink.exe (the command-line version of Putty), and created a batch file with the following:
"C:\Program Files\rdiff-backup.exe" -v5 --no-hard-links --exclude-symbolic-links --remote-schema "plink.exe -i rsa.ppk %%s rdiff-backup --server" "C:\\Documents and Settings\Mrs. Jizldrangs\My Documents" mrsjizldrangs@myfileserver::/home/mrsjizldrangs/backups-my-docs
This batch resides in the same directory as plink.exe, which is why the full path isn't specified. Here is a breakdown of the arguments:
- no-hard-links and exclude-symbolic-links: these are necessary for windows machines per the blog post above
- remote-schema: The method of contacting a remote server (in our case, an SSH server over plink.exe)
- The last two arguments are the source directory and destination (i.e. backup) directory
- i: the name of the ssh key to use for authentication. I created an SSH keypair using PuttyGen, which generates 2 files, a public key and a private key. I added the contents of the public key to the authorized_keys file on the server, and the argument specified above is the private key, which is also located in the same directory as plink.exe and the batch file
- The %%s tells rdiff-backup to run what follows on the remote server
- rdiff-backup --server: This is run on the remote machine and all it does is start rdiff-backup in server mode
rdiff-backup -v5 --force -r now --exclude **/.subversion/** --exclude **/.gvfs/** --exclude **/.local/** myFileServer::/home/jizldrangs/vengeance-backup ~
Here's a breakdown of the arguments:
- v5: Verbosity level 5. The available levels are 1 being the lowest through 9 which outputs so much info that it is impossible to read. 5 is a nice happy medium as it lists the files it is working on.
- force: this is necessary to add when doing a restore to a directory that already has some version of the files you are trying to restore. In my case, the default Home directory created for me by Linux Mint already had some default folders, so I had to force rdiff-backup to overwrite them with the version from my backup.
- r: specifies a restore
- now: tells rdiff-backup when to restore as of (see the man page for alternative options if you want to go to a past backup)
- exclude: tells rdiff-backup that these folders exist in the backup but not to restore them
- the last two arguments specify where to restore from (i.e. the backup directory) and where to restore to (in my case the Home directory, you can change this to restore somewhere else and have access to multiple versions of your files)