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/
Installation
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.
On Ubuntu/Debian:
apt install librsync-dev rdiff-backup
On Fedora:
dnf install librsync rdiff-backup
On RHEL/CentOS:
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 usage examples
Backup of a local directory:
rdiff-backup foo bar
Backup a local directory to a remote location:
rdiff-backup /local-dir hostname::/remote-dir
Restoring a local directory:
cp -a bar/dir foo/dir
Restoring files backed up 10 days ago:
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:
Backup script that utilizes rdiff-backup
https://github.com/eddinn/backup
Top comments (0)