Linux Hack of the Week #18: Using rdiff-backup
f you’re like me, you probably have a Linux box running in your house. Maybe it’s a Raspberry Pi, some other box as your file server, a media center, or just a box to tinker with. Regardless of the use case, as time goes on you will inevitably end up having a significant amount of data that should be backed up. The good news? Hard drives are cheap! You can use rdiff-backup to backup from disk-to-disk, or over SSH to a remote machine. Bottom line: you’ve got no reason to not backup your software.
Though I have mentioned home networks, this can also be used in production as a backup solution. I find it much easier to use, and just as reliable as tools like Bacula.
Install the Software
Installing is as easy as dnf install rdiff-backup:
Oddly, rdiff-backup is one of the few Linux commands where -h or --help does not give you command usage information. You can use the man page (man rdiff-backup) or visit this web page for more information. Let’s walk through a few examples.
In these examples, we’ll use a backup directory of /backup. This could be an NFS mount, a USB drive, or just another disk slice.
The simplest way to backup is to run rdiff-backup sourceDirectory backupDirectory. If you are using the /backup model, it’s important to make sure you backup into a destination folder beneath /backup. Here, I am backing up the folder example to /backup/example. To do that, I am using rdiff-backup example /backup/example:
Checking your work is as easy as running an ls:
You may notice a new folder, rdiff-backup-data, which is where metadata and versions are saved.
Yes, you read that correctly; rdiff-backup supports versioning. To restore a file, simply pick the day you want to restore back to and run rdiff-backup -r 1D file destinationFile:
Rdiff-backup will keep an infinite number of backups. Here, you can specify a date such as 1W/1D/2M, etc.
If you are in need of a Linux backup solution, give rdiff-backup a try. It is easy to use and doesn’t come with any overhead. As always feel free to let me know if you have any questions: firstname.lastname@example.org.
Facing growing threats and a rapidly expanding attack surface, understaffed and alert-fatigued organizations need more efficient ways to eliminate their exposure to vulnerabilities. Automox is a modern cyber hygiene platform that closes the aperture of attack by more than 80% with just half the effort of traditional solutions.
Cloud-native and globally available, Automox enforces OS & third-party patch management, security configurations, and custom scripting across Windows, Mac, and Linux from a single intuitive console. IT and SecOps can quickly gain control and share visibility of on-prem, remote and virtual endpoints without the need to deploy costly infrastructure.
Experience modern, cloud-native patch management today with a 15-day free trial of Automox and start recapturing more than half the time you're currently spending on managing your attack surface. Automox dramatically reduces corporate risk while raising operational efficiency to deliver best-in-class security outcomes, faster and with fewer resources.