I’ve been using rdiff-backup for my server backups along with mysqldump for the sql data for years now, as it gives me the ability to browse the increments on file system level and is extremely efficient and easy to use, both for local files and remote.
So what is rdiff-backup anyway?
rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, modification times, extended attributes, acls, and resource forks. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults.
– Taken from the official rdiff-backup page, http://www.nongnu.org/rdiff-backup/
Important: If you are operating over a network, you’ll have to install rdiff-backup on both servers, preferably both installations of rdiff-backup will have to be the exact same version.
apt install librsync-dev rdiff-backup
dnf install librsync rdiff-backup
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm rpm -ivh epel-release-7-9.noarch.rpm yum install librsync rdiff-backup
rdiff-backup foo bar
rdiff-backup /local-dir hostname::/remote-dir
cp -a bar/dir foo/dir
rdiff-backup -r 10D hostname::/remote-dir/file /tmp/file
You can also backup and restore from a remote location to another remote location.
Detailed examples can be found here: http://www.nongnu.org/rdiff-backup/examples.html
Here is the original version of the script that I use to backup my web and sql servers to a NFS mount on my backup server: