It works as follows, for a full dump
And for incremental dumps
The FILELIST is a internal list rdup writes to, to keep track of which files are in a backup. If you don't want this (i.e. make a full backup), use /dev/null here. The file /dev/null is handled specially by rdup: if detected no new file list is written. This is useful when only doing full backups and you want all files to be printed.
The DIRS/FILES can be specified multiple times. These are the directories and files you want to backup. If omitted it defaults to the current directory (.).
If the -N timestamp option is not given, all paths found are printed. Only when a -N timestamp file is given, times can be compared and an incremental output can be generated.
rdup prints a filelist to standard output. Subsequent programs in a pipe line can be used to actually implement to backup scheme. If FILELIST is empty or non existent all files in DIR are dumped. This is the same as a null dump. After a run a new FILELIST is written. No warning is given when FILELIST is an existing file, it just gets overwritten by rdup. New runs will print out only those files that have actually changed or are removed since the last run, thereby making incremental backups possible.
Files are checked for changes by comparing the c-time (change time), if this time is NEWER than the c-time of timestamp file the pathname is printed to standard output. When files are removed they are also printed to standard output, but they are prefixed with a '-'. See FORMAT below. The default format rdup uses is: "%p%T %b %m %u %g %l %s %n\n"
Note, that rdup also supports hashing of files, this makes it possible to check the local hash with the hash of the backed up file.
All errors are written to standard error. If the directory or file does not exist, they are skipped and a warning is emitted.
The general idea is to be very UNIX like and create a bunch of simple programs which each do a their specific thing very well. With rdup and a small shell script (50 lines) one can implement encrypted and compressed backups.
If a directory is excluded, rdup won't descend in that directory, so all files in that directory are also excluded.
The directories leading up to the directory to be backed up can not be excluded. If you use a command line like:
The directories '/home', '/home/miekg', '/home/miekg/bin' are always printed.
If you want to exclude the file '/home/miekg/blaat' you need to add the following regular expression: '/home/miekg/blaat'.
If you want to exclude all .mozilla/cache directories of all users you can use '/home/.*/.mozilla/cache/.*'. This doesn't exclude the directory itself and I'm assuming that the users' home directories are found under '/home'.
Also note that rdup does not print directories with a trailing slash.
Any file content is written in a block/chunk based manner. The last block is signaled with a null block. A block start entry is ascii and is formatted as follows: VVBLOCKBBBBB\n
Where 'VV' is the version, now '01', then the literal string 'BLOCK' and then the amount of bytes, typical '08192'. And then a newline.
An example:
01BLOCK08192
<START OF THE FIRST 8192 BYTES>01BLOCK00015
<ANOTHER 15 BYTES>01BLOCK00000
This option is used when streaming your backup to a remote machine.
A full-dump filelist is printed to standard output. And with:
An incremental dump filelist is printed. The file timestamp is used to save the exact time of rdup's run. The file LIST is used to calculate the correct incremental dump list, this is needed for files that are removed, or have a different type.
The following escape sequences are understood by rdup:
'p': '+' if file is new/modified, '-' if removed
'b': permission bits from lstat(2), octal in four digits
'm': the file mode bits, st_mode from lstat(2), decimal digits
'u': uid
'g': gid
'l': path name length
's': file size, zero if directory, major,minor for devices and
see CAVEATS for soft- and hardlinks.
'n': path name
'N': path name, but in case of a soft- or hardlink only
the link name.
't': time of modification (seconds from epoch)
'H': the SHA1 hash of the regular file, all zeros ("0") for all other types
'T': file type
To delimit the output of rdup with NULLs you can use '\0' in the format string.
33204 2050 31970 * 1000 1000 42 887
/home/miekg/git/rdup/.git/hooks/commit-msg
Where MODE is the st_mode from stat(2), DEV is the dev id as returned by the stat call and INODE is the inode number - rdup needs this info to decide if a directory is renamed. LINK is equal to 'h' for hardlinks, other wise it is '*'. UID and GID are the numeric user and group id of the file. PATH_SIZE is the length of PATH. FILE_SIZE the file size. And finally PATH is the path of the file.
A typical example is:
Where:
A typical example might look like this:
+- 0755 1000 1000 8 11288 bin/rdup
This example show that the file should be backed up, has a user and group id of 1000, the length of the path is 8 bytes, the size of the file it 11288 and it has "bin/rdup" as a path.
Directories are always printed by rdup.
This makes it possible possible for a remote shell script to receive the actual file and make a backup.
All field are identical as described in OUTPUT FORMAT, but there is one extra field and also see CAVEATS. The extra field is the FILE_CONTENTS, which concatenates the entire file to standard output.
The output when using the -c is changed as follows, for directories: the FILE_SIZE is zero and no content is printed. Thus:
is printed as '/home/bin/blaat -> /home/bin/bliep'. The PATH_SIZE is modified accordingly, where ' -> ' (4 characters) is also counted. The FILE_SIZE is not needed for soft- or hardlinks, so it is set the length of the link's name -- the part left of the ' ->', in this case the length of '/home/bin/blaat'.
If rdup encounters a hardlink it is handled in the same way, but the output type is set to 'h' instead of 'l'. A hardlink is only detected if rdup finds a file with the same inode and device number as a previous one, i.e. such hardlinks must be contained in your backup.
Again note: with '%N' only the link's name is printed. The FILE_SIZE is still set to the length of the link's name.
For devices the size field (%s) is changed to hold the major,minor number of the device. So if a major number is 8 and the minor number is 0 (under Linux this is /dev/sda), its size will be 8,0. The numbers are only separated with a comma `,'.
Licensed under the GPL version 3. See the file LICENSE in the source distribution of rdup.