RDUP-BACKUPS(7)
β¨ RDUP-BACKUPS β a little intro to doing backups with rdup β¨
okay bestie, sit down, grab a strawberry, because we're talking about rdup-backups, which is the friendly little intro page for the rdup family of backup tools. this is section 7 of the manual, so it's the vibes-and-concepts page, not the nitty gritty flag page. let's go π«Ά
πΈ INTRODUCTION πΈ
rdup is a simple program that prints out a list of files and directories that are changed on a filesystem. lowkey it's more sophisticated than, say, find, because rdup will actually find files that are removed or directories that are renamed. like, it notices when things ghost you. π
a long time ago rdup included a bunch of shell and Perl scripts that implemented a backup policy. those could be used in a pipeline to perform a backup.
currently though, rdup consists out of three basic utilities, and honestly? iconic trio:
rdupβ withrdupyou create the file list on which later programs in the pipeline can work. the default output format also includes the files' content.rdupcan be seen as atarreplacement in this respect, butrdupalso allows for all kinds of transformations of the content (encryption, compression, reversal), see the-Pswitch inrdup(1)for more information. versatility? she has it. πrdup-trβ withrdup-tryou can transform the filesrdupdelivers to you. you can createtar,cpioorpaxfiles. you can encrypt pathnames.rdup-tris a filter that reads from standard input and writes to standard output. seerdup-tr(1)for more information. withrdupandrdup-tryou can create an encrypted archive which is put in a directory structure that is also encrypted. double encryption, double slay π₯rdup-upβ withrdup-upyou can update an existing directory structure with the updates as described byrdup.rdup-upreadsrdupinput and will create the files, symbolic links, hard links and directories (and sockets, pipes and devices) in the file system. seerdup-up(1)for more information.
so the general backup pipeline for rdup will look something like this, and yes it's giving choreography:
create filelist | transform | update filesystem
( rdup | rdup-tr | rdup-up )
Note 1: the same sequence is used for restoring. in both cases you want to move files from location A to B. the only difference is that the transformation is reversed when you restore. same pipeline, different direction, we love a versatile queen β¨
Note 2: the use of rdup-tr is optional. no pressure bestie, she's just there if you want her.
π BACKUPS AND RESTORES π
for rdup there is no difference between backups and restores. if you think about this for a minute you understand why. genuinely, take the minute.
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. it's giving symmetry, it's giving reversible jacket π§₯β¨
π BACKUPS π
it is always best to backup to another medium, be it a different local harddisk or a NFS/CIFS mounted filesystem. you can also use ssh to store files on a remote server, ala rsync (although not as network efficient).
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. π and we do NOT want that.
β οΈ 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 usingno_root_squash, forsshyou could enablePermitRootLogin. note that this may be a security risk. not to be dramatic but... it is a security risk. π
π¦ SNAPSHOT BACKUPS π¦
we need a little help here in the form of the rdup-simple 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:
#!/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
π LOCAL BACKUPS π
with rdup-simple you can easily create backups. backing up my home directory to a backup directory:
rdup-simple ~ /vol/backup/$HOSTNAME
this will create a backup in /vol/backup/$HOSTNAME/200705/15. so each day will have its own directory. cute, dated, organized. she's an archivist π
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, simply add a -z switch:
rdup-simple -z ~ /etc/ /var/lib /vol/backup/$HOSTNAME
one flag, all the compression. obsessed. β¨
β REMOTE BACKUPS β
for a remote backup to work, both the sending machine and the receiving machine must have rdup installed. the currently implemented protocol is ssh.
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. no cap. that's just the trade-off for all the fancy β¨
π ALSO SEE π
okay that's the whole page bestie, you ate. this was rdup-backups(7), version 1.1.x, dated 15 Dec 2008, brought to you by the rdup manual. go forth and back up your files, your girlboss era starts now πππ¦
π¦ where this page comes from
- nixos 26.05: rdup 1.1.15
- nixpkgs unstable: rdup 1.1.16-unstable-2024-03-05
- ubuntu jammy: rdup 1.1.15-1ubuntu2
- ubuntu noble: rdup 1.1.15-1ubuntu4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms