Langue: en

Autres versions - même langue

Version: 15 Dec 2008 (debian - 07/07/09)

Section: 7 (Divers)


rdup-backups - introduction into making backups with rdup


rdup is a simple program that prints out a list of files and directories that are changed changed on a filesystem. It is much more sophisticated than for instance find, because rdup will find files that are removed or directories that are renamed.

A long time ago rdup included a bunch of shell and Perl scripts that implemented a backup policy. Currently rdup consists out of three basic utilities:

With rdup you create the filelist on which later programs in the pipeline can work. With rdup -c the file's contents is also echo-ed to stdout.
With rdup-tr you can transform (encrypt, compress, whatever...) the files rdup delivers to you.

rdup-tr reads rdup input and will create rdup -c output.

With rdup-up you can update an existing directory structure with the updates as describe in the rdup archive.

rdup-up reads rdup -c input and will create the files, symlinks, hardlinks and directories (and sockets, pipe and devices on the file system.

So the general backup pipeline for rdup will look some like this:

    create filelist  |  transform file content  |  update filesystem

There is also a little shell script that can be used to create a hard linked directory structure, this script rdup-ln.sh is installed in '/usr/lib/rdup/'. The script looks back for previous backup and then creates a hardlinked directory structure. By using this script you create a YYYYMM/DD backup structure, where each YYYYMM/DD directory contains a full view of your filesystem at that date. This script very much depends on being able to use GNU date and GNU cp.

From the return code of this script you know what to do, if the exit code is 0 an incremental backup needs to be made. If the exit code is 1 a full backup is in order. An exit code of 2 means there was some kind of error.

With these three (four) tools you can create your own backup solution, see SNAPSHOT BACKUPS later in this document.


rdup can create two types of output:
a list of pathnames and path attributes
a list of pathnames and path attributes and the files' contents

The latter is often called 'rdup -c' output after the switch (-c) which enables this ouput. 'rdup -c' output is comparable to archive formats like tar or pax.

The first one is just called the normal or list output.

In rdup(1), rdup-tr(1) and rdup-up(1) it says what output a command can create and what input it expects.


For rdup there is no difference between backups and restores. If you think about this a minute you understand why.

Making a backup means copying a list of files somewhere else. Restoring files is copying a list of files back to the place they came from. Same difference. So rdup can be used for both, if you did any transformation with rdup-tr during the backup you just need to reverse those operations during the restore.


It is always best to backup to another medium, be it a different local harddisk or a NFS/CIFS mounted filesystem or use the remote backup capabilities (-c) to securely copy the backup to another system all together.

If you backup to a local disk you can just as well use rsync or plain old tar, but if you store your files at somebody else's disk you will need encryption. This is where you go beyond rsync and rdup comes in.         


We need a little help here in the form of the rdup-ln.sh script. Keep in mind that the following scripts can also be run remotely with the help of ssh.

The following script implements the algorithm of rdup-simple.

 # some tmp. file are saved in ~/.rdup. This directory must exist
 DIR=/home           # what to backup
 TODAY=$(date +%Y%m/%d)  # same as in rdup-ln.sh
 # for remote backup, this has to run on the remote host!
 /usr/lib/rdup/rdup-ln.sh $BACKUP/$HOSTNAME
 case $RET in
         echo Error >&2
         exit 1
         # full dump, remove filelist and timestamp file
         rm $LIST $STAMP
         # inc dump
         # do nothing here
 # this is the place where want to modify the commandline
 # right now, nothing is translated we just use 'cat'
 rdup -N $STAMP $LIST $DIR | rdup-tr -Pcat | rdup-up $BACKUP/$HOSTNAME/$TODAY
 # or do a remote backup
 #rdup -N $STAMP $LIST $DIR | rdup-tr -Pcat | ssh root@remotehost \
 #       rdup-up $BACKUP/$HOSTNAME/$TODAY


rdup(1), rdup-tr(1), rdup-up(1) or http://www.miek.nl/projects/rdup/