Easily Backup your Local Data to the Cloud in Linux

📆 · ⏳ 4 min read · ·

Introduction

Picture this: Your computer, with all its countless files, documents, photos, and memories, suddenly crashes. Or worse, it gets stolen, and you’re left with nothing but frustration and regret. Sounds like a nightmare, doesn’t it? That’s precisely why data backups are essential in today’s world. It’s not a question of if, but when you’ll need them.

I started exploring options of taking off-site backups essentially on some cloud storage provider and that is when I came across rclone ↗️. Let’s explore what it is and how to use it.

Introducing rclone: Your Data’s Guardian Angel

Rclone ↗️ is a powerful, open-source command-line program designed to manage files and data across a multitude of cloud storage services. It’s versatile, robust, and, best of all, it supports a wide range of cloud providers ↗️, including Google Drive, Dropbox, OneDrive, and many more.

The beauty of rclone is that it doesn’t restrict you to a single cloud service. You can set up your files to be continuously and seamlessly backed up to multiple cloud storage providers, keeping your data even safer. Plus, rclone is supported on a variety of operating systems, making it a go-to solution for Linux, Windows, and macOS users.

Setting Up Rclone with Google Drive

Let’s take an example storage provider and set up rclone with it. I’ll be using Google Drive as an example.

Google Drive is a popular choice for cloud storage due to its generous free storage space, making it an ideal candidate for safeguarding your important files.

Step 1: Install Rclone

First, ensure that you have rclone installed on your system. You can follow the installation instructions from the official documentation ↗️ specific to your operating system. Once installed, you can start configuring your Google Drive backup.

Step 2: Configure Rclone for Google Drive

Now comes the fun part. Open your terminal and type:

Terminal window
rclone config

This command launches the rclone configuration wizard, which will guide you through the process of setting up Google Drive as a remote storage location. Follow these steps:

  1. Select n for New remote.

  2. Give your remote a name; for example, gdrive.

  3. Choose the number corresponding to Google Drive. which was 18 when I tried setting it up.

  4. For the Client ID and Client Secret, press Enter to leave them empty.

  5. For the Option scope. choose 1 for Full access all files, excluding Application Data Folder.

  6. For Option service_account_file press Enter to leave it empty.

  7. For Edit advanced config? you can choose n for No. This step is optional.

    But what I did was actually choose y and then set scope to drive and root_folder_id to the folder id of the folder I wanted to backup to.

    I did this so that I can backup to a specific folder on my google drive and also choosing the scope as drive means that rclone only have permissions to read/write to that specific folder and not the entire drive.

  8. Next, set Use auto config? to Y, and rclone will generate an authentication link.

  9. Open the link in your web browser and log in to your Google account to grant rclone access to your Google Drive.

    If your are running rclone from a headless system (which I was) then you won’t have access to a browser. In that case rclone will provide a link which you can copy and paste in your other device where you have browser and upon successful authentication you will be provided with a verification code which you can copy and paste back in your terminal.

  10. Copy the verification code provided in the browser and paste it into your terminal.

  11. Confirm the setup, and your Google Drive is now configured as a remote storage location.

This is it, you have successfully configured rclone with Google Drive. At this point you have your Google Drive (or a specific folder on your Google Drive) configured as a remote storage location and you can use rclone to copy files to and from it.

Step 3: Use Rclone for Backups

With your Google Drive remote configured, you can now use rclone to upload and manage files on Google Drive. For instance, to copy a local folder to your Google Drive, use a command like this:

Terminal window
rclone copy /path/to/local/folder gdrive:backup-folder

You can schedule this command to run at regular intervals using a cron job, ensuring that your files are continuously backed up to Google Drive.


And there you have it! Your local files are now being safely and continuously backed up to the cloud using rclone.

No more worries about unexpected data loss or system failures. Your data is secure, accessible, and ready to be retrieved whenever you need it.

Conclusion

In the digital age, data is king, and safeguarding it should be a top priority. With rclone, you’ve got a reliable tool at your disposal to keep your data protected and accessible, no matter what life throws at you.

So, why wait? Start exploring rclone and make your data backup process a breeze. Your digital world will thank you.

You may also like

  • Mount a drive permanently with fstab in Linux

    Let's see how to mount a drive permanently in Linux using the fstab file which will mount the drive automatically on boot.

  • Setup Jellyfin with Hardware Acceleration on Orange Pi 5 (Rockchip RK3558)

    Recently I moved my Jellyfin to an Orange Pi 5 Plus server. The Orange Pi 5 has a Rockchip RK3558 SoC with integrated ARM Mali-G610. This guide will show you how to set up Jellyfin with hardware acceleration on the Orange Pi 5.

  • HTTPS with self-signed certificates for your Homelab services

    In this article we will deep dive into understanding how we can setup HTTPS with self-signed certificates for our Homelab services.This is often required when you are running your own services and you want to access them over HTTPS.