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
In computing, the utility diff is a data comparison tool that computes and displays the differences between the contents of files. Unlike edit distance notions used for other purposes, diff is line-oriented rather than character-oriented, but i ...
files by rdiff-backup.
As the name implies, rdiff-backup uses the
rdiff
rsync is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files. It is commonly found on Unix-like operatin ...
method (more exactly, the reimplementation of
rsync
rsync is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files. It is commonly found on Unix-like operatin ...
within librsync) to compute the differences between file versions. rdiff-backup is able to back up files across different machines via
ssh
The Secure Shell Protocol (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. Its most notable applications are remote login and command-line execution.
SSH applications are based on a ...
.
Usage
Beginning with version 2.2, the flags passed to rdiff-backup are either general, or specific to the operation. For example, disabling fsync (see below) is an option that is general, and thus comes after rdiff-backup. --no-compression is specific to the backup mode, and thus comes after backup.
Backup
Normal operation is rdiff-backup backup .
gzip
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
compression of increment files can be disabled with --no-compression after the backup flag. The options -v 5 and --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 will restore to the entire backup, a single file or a sub-directory. can be specified in one of several ways:
* as a date, for example "2020-02-14" (which will be interpreted as
midnight
Midnight is the transition time from one day to the next – the moment when the date changes, on the local official clock time for any particular jurisdiction. By clock time, midnight is the opposite of noon, differing from it by 12 hours ...
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 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 .
Simpler (but not always correctly, as the
file permission
Most file systems include attributes of files and directories that control the ability of users to read, change, navigate, and execute the contents of the file system. In some cases, menu options or functions may be made visible or hidden dependin ...
s might not be properly restored), the most recent backup can also be restored by copying a backed-up file or directory with cp -a or
rsync
rsync is a utility for efficiently transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files. It is commonly found on Unix-like operatin ...
-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
gzip is a file format and a software application used for file compression and decompression. The program was created by Jean-loup Gailly and Mark Adler as a free software replacement for the compress program used in early Unix systems, and ...
.
Deleting old backups
Only the oldest backups can be removed, with rdiff-backup --remove-older-than . The ability to delete the oldest versions of specific files (or directories) is scheduled to appear in version 2.2.
When deleting old versions, takes the same arguments as when restoring files or directories (see above).
Problems
rdiff-backup does not work under Linux with
SSHFS
In computing, SSHFS (SSH Filesystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation over a normal ssh connection. The client interacts with the remote file system via the SSH ...
and
exFAT
exFAT (Extensible File Allocation Table) is a file system introduced by Microsoft in 2006 and optimized for flash memory such as USB flash drives and SD cards. exFAT was proprietary until 28 August 2019, when Microsoft published its specificat ...
file systems, though
FAT
In nutrition, biology, and chemistry, fat usually means any ester of fatty acids, or a mixture of such compounds, most commonly those that occur in living beings or in food.
The term often refers specifically to triglycerides (triple es ...
and
NTFS
New Technology File System (NTFS) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default file system of the Windows NT family. It superseded File Allocation Table (FAT) as the preferred f ...
do work.
This is mostly due to their implementation as
FUSE
Fuse or FUSE may refer to:
Devices
* Fuse (electrical), a device used in electrical systems to protect against excessive current
** Fuse (automotive), a class of fuses for vehicles
* Fuse (hydraulic), a device used in hydraulic systems to prote ...
module, causing delays in certain operations, making it probably unfit for backup purposes.
No file system is explicitly supported or unsupported, but rdiff-backup does tests before starting a backup, and refuses to progress on file systems deemed unfit.
Regarding exFAT, by using the newer in-kernel exFAT-driver, this limitation ''should'' be overcome.
rdiff-backup cannot backup to a SFTP destination.
rdiff-backup recognizes changed files only by file size as well as modification time (
mtime Mtime may refer to:
*st_mtime
is a Unix system call that returns file attributes about an inode. The semantics of vary between operating systems. As an example, Unix command uses this system call to retrieve information on files that inclu ...
). To make sure all changed files have been backed-up, running rdiff-backup --compare-hash (or rdiff-backup --compare-full for a byte-wise comparison) will display all changed files. Then, using
touch
In physiology, the somatosensory system is the network of neural structures in the brain and body that produce the perception of touch ( haptic perception), as well as temperature ( thermoception), body position ( proprioception), and pain. It ...
, the modification time of all problematic files can be reset to now, and thus, they will be included during the next rdiff-backup run.