Been working in the IT business since around '98 and survived multiple deployments down in the Mediterranean.
Latest posts by Edvin Dunaway (see all)
- Streamlining the setup of a new user workspace on Ubuntu/Fedora - October 24, 2019
- Backups with rdiff-backup and mysqldump - October 19, 2019
- Manage dotfiles with the GNU stow command - September 30, 2019
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
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 a script that I use to backup my web and sql servers to a NFS mount on my backup server: