Good backups are an essential thing in the modern digital era, when so much of our lives revolves around computers, phones, and the internet. Here is how I back up my Linux laptop to make sure I don’t lose anything important.
Organization Makes Good Backups Easy
Before I worried about exactly how I was going to handle backing up my PC, the first and most important thing was to get everything organized. I don’t need a complete image of my operating system—I can always reinstall programs.
What is really important are files: tax documents, important work documents, things like that.
I’d recommend sorting your important files into only a few folders that don’t have a lot of extra stuff. If you’re paying for cloud storage, you don’t want to eat up space by unnecessarily backing up your entire downloads folder.
In my case, I packed everything into one folder I named Sync, then created three subfolders named Backup Picures, Backup Documents, and Backup Downloads respectively. That way, all I need to do is point my backup software at the Sync folder and all of the sub-files and folders get backed up automatically.
Choose a Cloud Storage Service
If you’re backing up your files to the cloud, there are two big things to consider:
- Cost per gigabyte of storage.
- Their safety track record.
Most cloud services have a range of options with different prices, but most range between 50GB per dollar to 200GB per dollar. The difference is mostly down to whether you pay annually or monthly, and how much storage you buy.
I’m switching to Proton Drive for most of my cloud storage needs; their plans all pretty much cost a dollar per 50GB of storage if you pay annually.
I also had to make sure whatever service I was using was supported by rclone. The rclone website has a long list of every service they support. Luckily, Proton Drive is one of them.
I chose Proton Drive specifically because of Proton’s reputation for being privacy and security first.
Set Up Rclone
I’m running Kubuntu, so I installed rclone using the DEB file from the rclone website. You’ll need to follow the instructions for your distro, whatever that may be.
These instructions will be for ProtonDrive. There will be some differences, but the individual instructions for each cloud provider can be found on the rclone website.
Once it is installed, however, the setup is extremely easy.
Start by opening up a Terminal window and running:
rclone config
I need to set up a new remote, so I hit n and then named it remote1. You can name yours whatever you like, though I’d recommend that you avoid using spaces in the name. I’ll use remote1 any time I need to access this later. You’ll need to use the name you pick.
The next prompt is a list of supported cloud services. Just find your cloud service on the list, type it in, and hit Enter. Proton Drive is 45, so that is what I entered.
From there, all you have to do is provide the required information to log into your cloud account.
Once that is done, you can use the rclone command to manipulate the files and folders you have stored on the cloud. For example, to list all your folders, type:
rclone lsd remote1
Now all you need to do is tell rclone to copy the files to Proton Drive.
My Sync folders is located at:
/home/lunarity/Desktop/Sync/
So the command to copy that to Proton Drive would be
rclone copy /home/lunarity/Desktop/Sync/ remote1:backup
You could also use rclone’s sync command, but I’m avoiding it because I don’t want anything deleted from the cloud storage solution automatically.
Scheduling Automatic Backups
Of course, backups aren’t all that helpful if you forget to make them. I’m not great about remembering to do that sort of thing manually, so I set up my system to do it automatically once a day, just to be safe.
Rclone doesn’t have an integrated tool for this, but you can easily create a cron job or systemd timer to handle that. I’d strongly recommend using systemd timers instead of cron jobs, since they’re more flexible.
First, I created a small bash script that contained the command to copy files from my Sync folder to Proton Drive. Here’s how to do it.
Open up a Terminal window (Konsole on Kubuntu), navigate to the folder where you want to store the script, then type the following command:
vi rclone_copy_script.sh
That creates and opens a bash shell script named rclone_copy_script. Once it is open, duplicate whatever command you used to clone your files to your cloud sync. In my case that was:
rclone copy /home/lunarity/Desktop/Sync/ remote1:backup
So when all is said and done, you should see something like this in your script file:
Type :wq then press Enter to save and exit the file. While we’re here, run the following command to make the script executable.
chmod +x rclone_copy_script.sh
Also type pwd into the console to make sure you know exactly where this script is stored—you’ll need it later.
Once you’re at this step, you need to pick which scheduler you’re going to use: a cron job or a systemd timer. There is a fair amount to be said about each, but I’d recommend that you use a systemd timer since they’re newer and more versatile. I have mine set to run 15 minutes after I boot my PC.
What About Encryption?
The contents of those files were not encrypted on your device, and that does pose a potential security vulnerability depending on which cloud storage solution you use.
If that is a concern to you, you can always encrypt them first using a tool like VeraCrypt or rclone’s crypt function.
That way, you can be as sure as humanly possible that, even if your Proton Drive is compromised somehow, your sensitive data won’t be leaked.
However, I’m using Proton Drive, and Proton claims that everything uses end-to-end encryption. For my purposes, I’m content that they’re secure enough.
Of course, cloud backups are only one part of a secure backup solution. Ideally, you should have another drive (not a flash drive!) that you keep in a safe place to ensure nothing important gets lost.