Google Drive Backup with rclone on Linux

Google Drive Backup with rclone on Linux

Here we can see “Google Drive Backup with rclone on Linux”

Although there is no official Google Drive interface for Linux, you can back up to your Google Drive using the rclone software from the command line. We will show you how to do it.

Google Drive isn’t available on Linux.

Despite promising “coming soon” Linux support in 2012, there’s no sign that Google will ever release a native Linux client for Google Drive. Instead, various unauthorized third-party alternatives, such as InSynchq, overGrive, and ODrive, and several file browsers, such as Files in GNOME, connect with Google Drive.

Also See:  WWDC 2021: What do you expect to see from Apple?

The third-party apps are commercial items that can be purchased outright or through a subscription. They operate well and don’t cost a lot of money; in fact, overGrive has a free version with restricted capability.

But what if you want to use the command line to make and perform backups? Alternatively, how about incorporating such a feature into scripts? All of this is possible thanks to rclone, a fantastic application. You can use rclone to back up, download, and synchronize files with over forty different cloud services. It’s similar to rsync but for clouds.

Installing rclone 

Installing rclone  Fortunately, there is an installation script that should work on any Linux distribution. Curl is used in the installation procedure. Curl was already installed on Fedora 31, and Manjaro 18.1.0 on the PCs used to study this article, but curl had to be installed on Ubuntu 18.04 LTS.

To install it on Ubuntu, use the following command:

sudo apt-get install curl

After curl is installed, run the following command to install rclone:

curl | sudo bash

You’ll receive a success message after the rclone installation is complete.


The rclone tool has now been installed on your Linux computer. The following step is to complete the setup and authorize rclone to access your Google Drive.

Creating an rclone Remote Connection

In the rclone universe, connections to remote cloud services are referred to as “remotes.” For Google Drive, we’ll need to make one. With this command, you can begin the rclone configuration process:

rclone config
  1. The configuring process raises a lot of questions. But don’t worry; many of them can be kept at their default settings and accepted simply by pressing “Enter.”
  2. There are no remotes configured, according to rclone. To make a new remote, press “n” and then “Enter.” It will ask for your name. It’ll be known as “google-drive.” You may use any name you choose.


3. You can choose the type of storage you want to create a remote connection to from a long menu.


4. Make a note of the number of the entry for Google Drive as you go down the list.


5. We can see that it is number 13 in this case. Press “Enter” after entering this as the storage type.


6. A Google Application Client ID is requested. To accept the default, press “Enter.”


7. After that, you’ll be asked for a Google Application Client Secret.


8. Hit “Enter” once again. When rclone is running on your Google Drive, you’ll be asked to specify the scope it will have. Enter by pressing “1” and then “Enter.”


9. Hit “Enter” to get the “ID of the root folder.”


10. Press “Enter” at the “Service Account Credentials” screen.


Also See:  Apple's New SandBox Security Feature Shields You From Malicious iMessages

11. Press “Enter” at the “Edit advanced config” box. Press “y” and then “Enter” on the “Use auto config” menu.


12. This triggers rclone to connect to your Google Drive and open your browser, allowing you to grant rclone permission to interact with your Google Drive.


13. Select the Google account you want to use from the drop-down menu in your browser window.

14. Allow rclone access to your Google Drive by clicking the “Allow” button.

15. You’ll see a “Success!” notification in the browser window once authentication is complete. Return to the terminal window by closing the browser.

16. Type “n” and then “Enter” at the “Configure this as a team drive” window.


17. Type “y” in the “Yes, Edit, Delete” menu and then press “Enter.”


18. Type “q” and hit “Enter” at the last menu.


Backup Script for rclone

The rclone application has a lot of features. That’s fantastic, but it also means you have a lot of choices. The command we’ll look at below transfers files from your local computer to your Google Drive account. This is a one-way copy to the cloud; rclone can perform a two-way synchronization between your Google Drive and your local machine. This serves as a simple type of off-site backup for us.

Save this on your PC by typing (or copying and pasting) it into a text editor. It was given the name After that, you are free to call it whatever you like.


/usr/bin/rclone copy --update --verbose --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s "/home/dave/Documents" "google-drive:LinuxDocs"

The following are the definitions of the parameters:

  • Copy: Copies files from a local computer to a remote storage location, skipping files already on the remote storage location.
  • Update: Skip any remote storage files with a changed time that is newer than the file on the local machine.
  • Verbose: Displays detailed information about each file transferred.
  • Transfers 30: This specifies how many files will be copied in parallel.
  • Checkers 8: The number of “checkers” to run simultaneously. Checkers keep an eye on the transactions that are taking place.
  • contimeout 60s: Connection timeout in seconds. It specifies how long the clone will attempt to connect to the remote storage.
  • Timeout 300s: A transfer is considered broken and disconnected if it remains idle for this long.
  • Retries 3: The entire copy action will be resumed if there are this many faults.
  • Low-level-retries 10: A low-level retry attempts to repeat a single unsuccessful operation, such as an HTTP request. This parameter limits the number of retries.
  • Stats 1st: rclone can provide statistics on the files that have been transferred. This reduces the statistics update frequency to one second.
  • “/home/dave/Documents”: This is the local directory that will be copied to the remote storage.
  • “google-drive:LinuxDocs”: The remote storage’s target directory. It’s worth noting that “google-drive” is the name we assigned this remote Connection during the rclone config phase. Also, notice the colon “:” used to separate the remote storage name from the directory name. The forward slash “/” is used to divide subdirectories. The destination directory will be created if it does not already exist.
Also See:  How to Sync Your Desktop PC with Google Drive (and Google Photos)

Although some of these values are defaults, we’ve included them here to talk about them. So you’ll know which parameter to update if you need to change a value this way.

Use the following command to make the script executable:

chmod +x

Backup Script Execution

Our backup script will replicate the contents of our Documents folder to Google Drive. In addition, we have a library of sheet music in our Documents section.

With this command, we can start the backup script:


We requested statistics updates every second (—stats 1s) and lengthy reports (—verbose). As a result, it’s no surprise that we get a lot of screen output. Turning on verbose output for new features is usually a good idea so you can discover problems. Then, once you’re certain that everything is working smoothly, you can reduce the amount of output.


A final summary informs us that 60 files were successfully transferred with no faults. However, it took about 24 seconds to complete the transfer.

Let’s look at our Google Drive to see what’s going on with our cloud storage.

So far, a directory called “LinuxDocs” has been created, which appears to be promising. However, when we double-click it to open it, we can see that all files have been moved to our Google Drive.

Viewing Google Drive Files with rclone

Right from the terminal window, we can use rclone to peek into the Google Drive folder:

rclone ls google-drive:/LinuxDocs

The Tip of the Iceberg

It’s fantastic that we can do this copying directly from the command line. We can leverage our cloud storage in our scripts, and we can use cron to schedule the execution of backup programs.

You should check out rclone’s documentation and a great website for a comprehensive list of commands. We’ve only scratched the surface here, and a little more reading and experimenting with rclone will more than pay for itself.

This isn’t a genuine backup in the strictest sense. It’s an off-site, remote copy of your files and data, which is certainly useful, but it’s only a copy of files. Versioning and other capabilities that proper backup systems would provide are not available.

As a result, rclone should be used in conjunction with other backup methods. Rclone is a simple technique for storing your data geographically far from your home or office as an additional layer to a current backup regime. That can only be a good thing.


I hope you found this information helpful. Please fill out the form below if you have any queries or comments.

Also See:  How to Bypass Blackout Workaround

User Questions:

1. What is the procedure for using rclone Mount Magisk?

  • /sdcard/.rclone/rclone.conf is where you should save your rclone.conf file.
  • /sdcard/.rclone/.*.params is where you can add custom parameters.
  • Reboot or use the terminal to run rclone-mount.
  • All of your rclone mount points will appear in the /mnt/cloud/ and /storage/cloud/ directories.

2. What exactly is the rclone command?

Rclone is a multi-threaded, open-source command-line software for managing or migrating content on the cloud and other high-latency storage. Sync, transfer, crypt, cache, union, compress, and mount is some of its features. Supported backends are listed on the rclone website, including S3 and Google Drive.

3. How do I find rclone files?

Each file you transfer is stored as a native object on the distant cloud storage system using Rclone. This means that utilizing different access methods. You can see the files you upload as expected (e.g., using the Google Drive web interface).

4. Can you use Google Drive on Linux? Hiccups, Rclone?

Google Drive on linux? Rclone, hickups? from linuxquestions

5. rclone for cloud backups 🙂

[solution] rclone for cloud backups 🙂 from linuxquestions

Also See:  How to Share Links to Your Google Doc as a PDF