How to automate your own backups with rclone and crontab on any Unix/Linux based computer

Data is backed up to a tape

I’ve been migrating away from Google’s cloud based software. I have concerns related to the security of my data as well as want access to my documents when the Google Cloud or my internet connection is having issues. I was able to download all of my data from Google Drive easily although this creates a new problem. I’m now responsible again for my own backups. Without a backups solution you risk losing your important documents. This post discusses how I created backups with rclone and how you can do the same.

This tutorial is written with Unix/Linux based computers only in mind. You might be able to get this working on Windows if you do your own research and experiments. This tutorial is not intended for Windows users and I cannot help them once something goes wrong.

Where to store the backups

I performed considerable research as to where to store my backups and decided to choose Backblaze. They provide 10GB of storage for free and then charge just $0.005/GB/month of storage. With a provider choose I installed a free and open source program called rclone. rclone works like rsync except for cloud storage providers. I was able to get started with it in just 15 minutes.

Create a Backblaze account and bucket for use with backups with rclone

To create a Backblaze account visit their signup page. You will need to answer a few questions about yourself and provide an email address, phone number, and a credit card for billing purposes. Once your account is set up and verified, visit the my account area. You’ll need to click create a bucket and choose a name for it. Make sure that the privacy setting is set to “private” or anyone who guesses the bucket name will be able to list and download your documents without needing a valid app key with access to your account. Once your bucket is created visit the App Keys section and create a key with access to your bucket. Write down the key id and secret, you’ll need it later when setting up rclone.

Install and Configure rclone to use your bucket

Visit rclone’s installation page (or on Debian Linux type sudo apt install rclone in a terminal window to save some time) and follow the instructions. Once it’s installed open a terminal. In the terminal run rclone config. It will ask you several questions, I choose the name b2 and then follow the prompts. I would recommend that you DO NOT enable the HARD DELETE option and allow your bucket to keep all object versions. It’s a bit more expensive as you’ll store multiple copies of all documents but is useful in the event you delete a document by mistake and the changes were to sync in error.

Configure crontab for automated backups with rclone

In your terminal type crontab -e and then view the bottom of the crontab file. Type in the string @hourly rclone sync /home/name/Documents/ b2:name/ --verbose replacing the folder path with your documents folder path and the bucket name with your bucket name. Most likely the crontab file will open in nano. You can read how to use the text editor nano on the Gentoo Linux Wiki. If it opens a different text editor then Google is your friend. It will help you find the information you need to use that text editor. Afterward save and close the file and your automatic backups will be in effect. You might want to run your first backup manually. Do this to make sure everything gets synced properly without any issue. Check your backups on a regular basis and ensure that they work as expected. Don’t wait until a data loss incident to find out if your backups work.

Conclusion

You can reduce costs by switching away from G Suite to your own backups solution. With a bit of work on the command line, you can roll your own backups with rclone solution in under an hour.

%d bloggers like this: