ArrowLeft Icon

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.

EnvelopeOpen IconStay up to date

Get notified when I publish something new, and unsubscribe at any time.

Need help with your software project? Let’s talk

You may also like

  • # linux

    Linux System Logs: An Overview of System Logs and How to Read Them

    Have you ever wondered where all the information about your system's activities and events is stored? Linux system logs contain a wealth of information that can help diagnose and troubleshoot system issues. In this article, we will give an overview of Linux system logs and explain how to read and interpret them.

  • # linux

    Linux RAID Configurations for Data Redundancy and Performance

    RAID is a popular method of combining multiple physical storage devices into a single logical unit, for the purposes of improving data redundancy and/or performance. Linux has a number of built-in tools and configurations for managing RAID setups. In this article, we'll provide an overview of RAID and the different RAID levels, as well as examples of how to configure and manage RAID arrays in Linux.

  • # linux# networking

    How I setup SSH config for effectively managing multiple servers

    Managing multiple servers can be a breeze with SSH configuration. Learn how to leverage the SSH config file to streamline your connections, enhance security, and make server management a whole lot smoother.