Back up data with ease
Neither music nor love will solve your computing problems, but timely backups just might, feels Shashank Sharma.
RESTIC
Credit:
https://restic.net
OUR EXPERT
Shashank Sharma
is a trial lawyer in Delhi and an avid Arch user. He’s been writing about open source software for 20 years and lawyering for over 10.
A good story is one that you can tell repeatedly for everyone’s amusement. It’s even better when you can tell the same story for different purposes. For instance, in a decade long ago, on a computer long since scrapped, he who shall not be named accidentally dd-ed an ISO image into a hard disk partition instead of a USB drive, resulting in the complete loss of data. This is a story that we’ve told repeatedly when talking about the risks of dd, but more importantly, to reiterate the benefit of backing up essential files and data.
While there’s a number of backup solutions to choose from, most feature a graphical interface that might not be to everyone’s liking. For CLI enthusiasts, there’s a featureful alternative. Restic is a fast and robust cross-platform backup solution that can help you create a local or remote copy of all your important files.
Although storage space isn’t much of a consideration for most these days, your chosen backup solution must use available space wisely. Restic does this with the use of deduplication, which ensures single backups of any given file. This means your backups take up less space, with the added advantage that it’s much easier and faster to find files in your backups.
Refer to the documentation to see how you can tweak the CPU usage and compression when performing backups.
With each instance of a backup operation, Restic creates a snapshot, which comprises the current state of the specified files and directories. All subsequent backup operations are incremental, and you can also perform a diff operation to see the differences between the specified snapshots. Restic also encrypts your backups by default, regardless of the destination, whether local storage device, remote host or removable storage media. In addition to these, you can also host your backups on cloud storage solutions such as Amazon, Google Cloud and others.
REMOTE BACKUPS
So far, we’ve only discussed storing backups on a local drive. Restic, however, supports storing backups on remote machines using SSH, in addition to cloud storage devices.
If you wish to store your backup on a remote machine, you have to configure SSH on both your host and remote machines. Ubuntu users can install OpenSSH with the sudo apt install openssh-server openssh-client command. Next, enable the SSH service with the sudo systemctl enable ssh command. If you’re running Fedora, run sudo dnf install openssh-server openssh-client instead, followed by sudo systemctl enable sshd .
Depending on the distro running on the remote machine, you may have to additionally allow incoming SSH connections. To do so, run the firewall-cmd --permanent --zone=public --addservice=ssh command.
With your remote device configured to accept SSH connections, you must first create a repository on the remote machine. You can do so with the sudo restic init -r sftp:username@remoteip:command.
To back up the same /mnt/Stuffsies/AA-Imp-Docs/ directory as from our previous example on to the remote host, we must now run restic backup -rsftp:linuxlala@192.168.0.13:backups/mnt/Stuffsies/AA\ Imp\ Docs .
Essentially, you have to replace the
when specifying the location of the repository with sftp:username@ip-address: .