A long time ago rdup included a bunch of shell and Perl scripts that implemented a backup policy. These could be used in a pipeline to perform a backup.
Currently rdup consists out of three basic utilities:
So the general backup pipeline for rdup will look something like this:
create filelist | transform | update filesystem ( rdup | rdup-tr | rdup-up )
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 during the backup you just need to reverse those operations during the restore.
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. Rsync cannot do per-file encryption, sure you can encrypt the network traffic with ssh, but at the remote side your files are kept in plain view. If you implement remote backups, the easy route is to allow root access on the backup medium. If the backup runs without root access the created files will not have their original ownership. For NFS this can be achieved by using no_root_squash, for ssh you could enable PermitRootLogin. Note that this may be a security risk.
The following script implements the algorithm of rdup-simple.
#!/bin/bash # some tmp files are saved in ~/.rdup. This directory must exist DIR=/home # what to backup BACKUP=/vol/backup TODAY=$(date +%Y%m/%d) LIST=~/.rdup/list-$HOSTNAME STAMP=~/.rdup/timestamp-$HOSTNAME # for remote backup, this has to run on the remote host! BUGBUG RET=$? case $RET in 2|*) echo Error >&2 exit 1 ;; 1) # full dump, remove file-list and time-stamp file rm $LIST $STAMP ;; 0) # inc dump # do nothing here ;; esac # this is the place where you want to modify the command line # right now, nothing is translated we just use 'cat' rdup -N $STAMP -Pcat $LIST $DIR | rdup-up $BACKUP/$HOSTNAME/$TODAY # or do a remote backup #rdup -N $STAMP -Pcat $LIST $DIR | ssh root@remotehost \ # rdup-up $BACKUP/$HOSTNAME/$TODAY
rdup-simple ~ /vol/backup/$HOSTNAME
This will create a backup in /vol/backup/$HOSTNAME/200705/15. So each day will have its own directory. Multiple sources are allowed, so:
rdup-simple ~ /etc/ /var/lib /vol/backup/$HOSTNAME
Will backup your home directory, /etc and /var/lib to the backup location. Also if you need to compress your backup, simple add a '-z' switch:
rdup-simple -z ~ /etc/ /var/lib /vol/backup/$HOSTNAME
Dumping my homedir to the remote server:
rdup-simple ~ ssh://miekg@remote/vol/backup/$HOSTNAME
The syntax is almost identical, only the destination starts with the magic string 'ssh://'. Compression and encryption are just as easily enabled as with a local backup, just add '-z' and/or a '-k keyfile' argument:
rdup-simple -z -k 'secret-file' ~ ssh://miekg@remote/vol/backup/$HOSTNAME
Remember though, that because of these advanced features (compression, encryption, etc, ...) the network transfer can never be as efficient as rsync.