rdup documentation

rdup in a few words

This little utility takes care of what to backup and will print the correct files in case of incremental dumps. It also has a few other handy options which concerns what files are printed. With this version the files' content is always included in rdup's output.

Next you need to something do do with this output. The following utilities may help you:

  • rdup -Pcmd0 flag: pipe all files through cmd0;
  • rdup-tr: transform rdup data into something else (rdup, tar, pax, etc);
  • rdup-up: update an directory with an rdup archive.

If you need a different backup strategy, write a different script.

Simple usage

To help the average user a script is included which will create a backup for you. The script is called rdup-simple, and works as follows. This creates a backup of your homedirectory in /tmp/backup/$HOSTNAME

rdup-simple ~ /tmp/backup

If you want it compressed use the following:

rdup-simple -z ~ /tmp/backup

This is comparable to

rdup -Pgzip /dev/null ~ | rdup-up -t /tmp/backup/$HOSTNAME

Which makes rdup pipe all files through gzip and give that output to rdup-up which updates the directory.

rdup-simple does not have a manual page, but is help output is probably sufficient, all supported flags are documented in the various rdup-* manual pages. This is what rdup-simple -h prints:

./sh/rdup-simple [+N] DIR [DIR ...] DEST

This is a wrapper around rdup, rdup-tr and rdup-up

DIR  - directories to back up
+N   - Look N days back for previous backups, defaults to 8
DEST - where to store the backup. This can be:
    ssh://user@host/directory (note: no colon after the hostname)
    ssh://host/directory
    file:///directory (note: 3 slashes)
    /directory
    directory

OPTIONS:
 -k KEYFILE encrypt all files: rdup -Pmcrypt,-fKEYFILE
 -g         encrypt all files: rdup -Pgpg,--default-recipient-self,--encrypt
 -z         compress all files: rdup -Pgzip
 -E FILE    use FILE as an exclude list
 -L         link previous backup directory (note: this is used internally)
 -f         force a full dump
 -v         echo the files processed to stderr and be more verbose
 -n         dry run; show the actually rdup commands, without executing them
 -x         pass -x to rdup
 -s NUM pass -s NUM to rdup-up (strip NUM leading path components)
 -X FILE    encrypt all paths with AES and key in FILE
 -Y FILE    decrypt all paths with AES and key in FILE
 -h         this help
 -V         print version

Advanced usage

A backup is performed by creating a pipeline between the utilities and rdup:

rdup /dev/null ~ | rdup-up -t /vol/backup/$HOSTNAME

Will create a full backup in /vol/backup/$HOSTNAME.

With rdup you can transform your data into whatever you like. For instance lets reverse the content of all our files.

rdup -Prev /dev/null ~ | rdup-up -t /vol/backup/$HOSTNAME

with this command, all files' content will be run through rev before it will be given to rdup-up. Ofcourse rev is a bit lame, but what about openssl, gzip, bzip2 or gpg which can all be combined... like so

rdup -Pgzip,-c,-f -Pmcrypt,-fKEY,-c /dev/null ~ |\
rdup-up -t /vol/backup/$HOSTNAME

The -P flag syntax is as follows:

-Pcommand,option0,option1,...,option6

7 options per command are supported (this is a compile time limit). So gzip in the example above is given the options -c and -f.

You can also directly create a tar archive, by using rdup-tr and the output (-O) format tar

rdup -Pgzip -Pmcrypt,-fKEY,-c  /dev/null ~ | rdup-tr -Otar >\
my-compressed-and-encrypted.tar

More examples

Also see writing your own scripts. Remember that this blog entry is written for an older rdup release. With 1.1.x the output will always include the files' content, unless you specify a different output the the -F flag.

Create a tar file

This can be done with rdup-tr:

rdup /dev/null bin | rdup-tr -Otar > backup.tar

Or compressed?

rdup /dev/null bin | rdup-tr -Otar | gzip -c -f > backup.tar.gz

Or compressed each file within the archive and then compress the archive again?

rdup /dev/null bin | rdup-tr -Pgzip,c,-f -Otar | gzip -c -f > backup.tar.gz

Create gzipped backup

rdup /dev/null bin | rdup-tr -Pgzip,-c,-f | rdup-up -t backupdir

Path encrypted output, where each path element is encrypted, so nobody can see your pathnames. For the really paranoid you can also encrypt each file with OpenSSL.

rdup /dev/null bin | rdup-tr -P,gzip,-c,-f -Xkeyfile | rdup-up -t backupdir

Remote usage

Remote usage of rdup is as simple as just dropping ssh in, as the next example shows, which dumps ~/docs to the remote host elektron.atoom.net in the directory /tmp/ssh.

rdup -Pgzip /dev/null ~/docs  | ssh elektron.atoom.net  rdup-up -t /tmp/ssh
miekg@elektron.atoom.net's password: <type the password>

and the dump is created. In other words: this just works as expected.

rdup's output

A typical line printed out by rdup looks like this:

+d 0755 1263636718 0 root 0 root 5 0 /home
<possible content>

These 8 columns convey the following message:

  1. +: add it
  2. d: the type, here: directory
  3. 0755: permissions
  4. 1263636718: modification time
  5. 0: uid
  6. root: username
  7. 0: gid
  8. root: groupname
  9. 5: path length
  10. 0: file/dir size, 0 for directories
  11. /home: absolute path
  12. a new line \n
  13. <possible content>: nothing in this case.

With files the content is printed. See rdup's manual page for more information.

FORMAT string

rdup supports a (-F FORMAT) option, with this you can specify what the output of rdup will be.

The default format is: %p%T %b %t %u %U %g %G %l %s\n%n%C

See the manual page for all supported escape sequences, and some extra explanation on the handling of sym- and hardlinks.