rdiff-backup
rdiff-backup is a backup software written in Python that creates reverse incremental backups. The most recent backup is thus directly accessible, while earlier backups will be reconstructed from diff files by rdiff-backup.
Original author(s) | Ben Escoto (2001-2005) Dean Gaudet, Andrew Ferguson, Edward Ned Harvey (2005-2016) Eric Lavarde, Otto Kekäläinen, Patrik Dufresne (Python 3 rewrite beginning in 2019) |
---|---|
Initial release | 2001 |
Repository | |
Written in | Python 3 since version 1.9 (until 2019: Python 2) |
Platform | Unix-like systems, MacOS, Windows (via Cygwin) |
Type | backup software |
License | GPLv3 |
Website | https://rdiff-backup.net/index.html |
As the name implies, rdiff-backup uses the rdiff method (more exactly, the reimplementation of rsync within librsync) to compute the differences between file versions. rdiff-backup is able to back up files across different machines via ssh.
Usage
Backup
Normal operation is rdiff-backup <source directory> <backup directory>
. gzip compression of increment files can be disabled with --no-compression
. The options -v 5 --print-statistics
show the backup's progress and some statistics.
Specifying --no-fsync
will disable fsync, causing a significant speedup, with an elevated risk of data loss.
Restoration of files or directories
rdiff-backup --restore-as-of <date> <backup> <source>
will restore to <source>
the entire backup, a single file or a sub-directory. <date>
can be specified in one of several ways:
- as a date, for example "2020-02-14" (which will be interpreted as midnight of the day in question), or as a datetime string like "2020-02-14T12:26:53+02:00" (which can be found by running
rdiff-backup --list-increments <backup>
first) - as a time span, for example "1M" will restore the files as they were one month ago
- as a number of backups, so "10B" will restore the 10th most-recent version
- or "now", which will restore the most recent backup.
It is also possible to find the relevant time-stamped file in the rdiff-backup-data/increments
directory, and run rdiff-backup <time-stamped file> <file or folder to be restored>
.
Simpler (but not always correctly, as the file permissions might not be properly restored), the most recent backup can also be restored by copying a back-upped file or directory with cp -a
or rsync -a
. A deleted file – recognizable by the suffix snapshot.gz
– can also be restored by retrieving it in the rdiff-backup-data/increments
directory, copying it to the source directory, and unpacking with gzip.
Deleting old backups
Only the oldest backups can be removed, with rdiff-backup --remove-older-than <date> <backup directory>
. The ability to delete the oldest versions of specific files (or directories) is scheduled to appear in version 2.2.
When deleting old versions, <date>
takes the same arguments as when restoring files or directories (see above).
Problems
As of version 2.0.0, rdiff-backup does not work with exFAT file systems, though FAT and NTFS are both supported.
rdiff-backup recognizes changed files only by file size as well as modification time (mtime). To make sure all changed files have been back-upped, running rdiff-backup --compare-hash <source directory> <backup directory>
(or rdiff-backup --compare-full <source directory> <backup directory>
for a byte-wise comparison) will display all changed files. Then, using touch
, the modification time of all problematic files can be reset to now, and thus, they will be included during the next rdiff-backup run.