Categories
Device

How to use rclone to back up to google drive on linux

If you have a Stony Brook email address, this also gives you access to a Google Drive account with virtually unlimited storage (the only restriction is that no single file can exceed 5 TB). This article will explain how to backup your data on SeaWulf to Google Drive using rclone

Audience: Faculty, Researchers and Staff

Setting Up Rclone

In order to backup your data onto Google Drive using rclone, first load the rclone module:

When using rclone for the first time, you will need to go through a one-time configuration process. The following steps (modified from the rclone documentation) will guide you through this process. Note that we are using the configuration name “my_backup” in this guide, but you may choose whatever name you wish.

In the shell, type the following to bring up the interactive configuration process:

Next, go through each step in the setup process, as indicated by the bolded answers to each question below.

At this point in the process you will be asked to log into your Google account. Please choose N at the step where it asks to Use AUTO CONFIG. This will then present you with a URL you can copy and paste into your own browser, to complete the google account authorization. Then, copy the verification code and paste it into the shell prompt. Note that you may receive an error message stating, “Failed to save new token in config file: section ‘my_backup’ not found”. This error can be disregarded.

From here, continue following the interactive process to complete the configuration:

Now that the configuration process is complete, you are almost ready to back up your data. Before you do, however, you should go back to your browser, navigate to Google Drive, and create a folder to store your backed up data. For the purposes of this guide, we will use a folder called “seawulf_backup”.

Backing Up Data

Next, navigate to the directory on SeaWulf that contains the files and/or folders that you would like to backup. To copy a single file to your Google Drive, type the following in the shell:

To copy a directory and all of its contents to Google Drive, using the following:

Note that there are several optional rclone arguments that you can set. Two important options include:

Increasing the values for these settings may increase transfer rates.

Although the speed at which rclone is able to copy data to Google Drive is dependent on a variety of factors (including settings used, available bandwidth, etc.), our benchmarks suggest that you may see single file transfer speeds around 350-450 megabits per second.

However, Google limits the number of files that can be simultaneously transferred. Thus, if you wish to backup a directory with a large number of small files, the transfer rate may be much slower. Because of this, it may be useful to create a compressed tarball archive file of any directories with a large number of files prior to using rclone. To do this, type the following in the shell:

This compressed archive file can then be copied to Google Drive with rclone as before.

Some sample rclone scripts with additional options can also be found in the following SeaWulf directory:

Rclone is a command-line tool for synchronizing files and directories between Google Drive, Amazon S3, Openstack Swift / Rackspace cloud files / Memset Memstore, Dropbox, Google Cloud Storage, and the local filesystem. It is a single binary file that contains a Go program. Rclone is an MIT-licensed Free and Open Source Software that can be found in its Github repository.

Installation

First, you need to install curl using the below command, if you already have, you can skip this step:

How to use rclone to back up to google drive on linux

By running the following command, you can install Rclone using the installation script:

How to use rclone to back up to google drive on linux

Installing Rclone using the script

Rclone now should be installed in your system.

Configuring

The next step is to run the rclone config command to generate your config file. It will be used for rclone authentication in the future. Run the following command to start the configuration setup.

Run rclone config

We now have the option of creating a new remote. We’ll definitely want to add a remote because we don’t have one right now.

Select “n” for remote

Give it a name; we’ve given it the name gdrive :

Following that, we’ll be given a list of sources to use with our new remote. Since we’re going to try Google Drive, we’ll pick 15

How to use rclone to back up to google drive on linux

We are selecting 15 which is Google Drive.

How to use rclone to back up to google drive on linux

We are selecting 15 which is Google Drive

Just press enter to leave default:

Just press enter to leave the default

You may simply leave the default answer, which is an empty ” “, for the remaining questions.

When prompted, select “autoconfig,” which will generate all the necessary information to link to your Google Drive and grant rclone permission to use Google Drive data.

Now you need login into your Google account and give permission to allow it.

How to use rclone to back up to google drive on linux

Give permission to rclone

Using Rclone

Now we’ll learn how to transfer/sync files and directories with Google Drive using Rclone. Here are some examples of what we can do with the Rclone function.

Copy Data with rclone

We may use rclone copy source: to copy a file or folder rclone copy source: path dest: path order

List Remote Directory

Sync data with rclone

Using the command we can easily synchronize the source with the destination. as rclone sync source: path dest: path

We’ve built Rclone and learned how to use it, which is great. As far as we know, this article explains what Rclone is, its functionality, and how to install and use it. Rclone is a command-line tool for synchronizing files and directories between Google Drive, Amazon S3, Openstack Swift / Rackspace cloud files / Memset Memstore, Dropbox, Google Cloud Storage, and the local filesystem.

Last updated October 29, 2020 By Community 61 Comments

Brief: A step-by-step tutorial showing how to use the rclone command line tool to synchronize OneDrive in Linux.

There are several cloud storage services available for Linux. There is Dropbox that gives 2 GB of free space. You can also use Mega where you can get 15 GB of free storage.

Microsoft’s own Cloud storage service, OneDrive gives 5 GB of free storage to any Microsoft account holder. The one major problem is that unlike Dropbox and Mega, Microsoft does not provide a desktop client for Linux.

This means that you’ll have to resort to using web browser for accessing your files in OneDrive which is not very convinient.

There is a hassle-free, GUI application Insync that lets you use OneDrive on Linux easily. But it’s a premium software and not everyone would like that.

If you are not afraid of the Linux terminal, let me show you a command line tool rclone that you can use for synchronizing Microsoft OneDrive in Linux.

How to use rclone to back up to google drive on linux

What is rclone?

Rclone is an open source command line tool that enables you to synchronize a local Linux directory with various cloud storage services.

With rclone, you can backup files to cloud storage, restore files from cloud storage, mirror cloud data, migrate data between cloud services, use multiple cloud storage as disk.

You can use it with Google Drive, OneDrive, Nextcloud, Amazon S3 and over 40 such cloud services.

Rclone is an extensive command line tool and using it could be confusing with so many options. This is why I wrote this tutorial to show you how to use rclone with Microsoft OneDrive.

Update: There is a separate tool called Rclone Browser that makes using rclone easier by providing a graphical user interface.

Sync Microsoft OneDrive in Linux with rclone

Using Rclone in Linux is not that complicated but requires some patience and familiarity with the Linux terminal. You need to tweak the configuration a little to make it work. Let’s see how to do that.

Step 1: Install Rclone

I am using Ubuntu 20.04 in this tutorial but you should be able to follow this tutorial in pretty much any Linux distribution. Just the rclone installation instruction could be different but the rest of steps remains the same.

In Debian/Ubuntu based distributions use:

For Arch-based distributions, use:

For other distributions, please use your distribution’s package manager.

Step 2: Adding new remote

Once you have installed rclone successfully, you need to configure rclone. Enter the following command in the terminal:

If it’s your first time using rclone, you have to add a new remote to rclone. Select ‘n‘ to add new remote.

Now you have to enter the name of remote. You can enter any name here that matches the cloud service so that it is easy to identify. I am using ‘onedrive‘.

Step 3: Select cloud service you want to sync with rclone

After entering name and hitting enter, you will see a list of cloud services like Google cloud storage, Box, One Drive and others.

You have to enter the number of the service you want to use. In this case, it’s ‘One Drive’. Make sure you enter the correct number.

As you don’t need to enter client ID or secret ID hit Enter twice.

Next enter ‘N’ for selecting no for advanced configuration. Of course, if you want to configure something very specific, you can go ahead with Y.

When you’re asked for ‘Use auto config’, press Y.

Step 4: Login to OneDrive account

When you enter ‘y’ and hit enter, your default browser will open and here you have to log into your Microsoft account. And if it asks for permission click on ‘yes’.

Step 5: Enter account type

Now you have to select account type. For most of the users it will be the first one, ‘One drive Personal or business’. I believe it is personal so go with 1.

How to use rclone to back up to google drive on linux

After that, you will get a list of ‘Drives’ associated with your account. So, for the most part, you need to select ‘0’ to select your drive and enter ‘Y‘ for yes in next step.

How to use rclone to back up to google drive on linux

It will ask for one last time if this configuration is okay? Hit ‘Y’ if it is.

How to use rclone to back up to google drive on linux

And then enter ‘q’ to exit the Rclone configuration menu.

How to use rclone to back up to google drive on linux

Step 5: Mounting OneDrive int file manager

Create folder in your home directory where you will mount OneDrive. I will name the folder “OneDrive”. You can name it whatever you want, but please make sure you change the name to yours in the commands.

Create a new folder with mkdir command in your home directory or wherever you want:

Now you have to use the following command:

In above command “one drive” is the name of the “remote”, so you should use the correct name there if yours is different. You can check the name of the “remote” in step 2 of this tutorial.

This command will mount one drive in given location and will continue to run in terminal. When you stop the process with, ctrl + c the one drive will be unmounted.

To mount one drive on startup, follow the next step below.

Step 6: Mount One Drive on startup

Every Linux distribution gives some way to manage startup application. I am using Ubuntu’s Startup Application Preferences tool here.

Open “Startup Applications“. And click on “Add“. Now, in the command field, enter the following:

That’s it. Now, you can easily use OneDrive on Linux without any hiccups.

As you can see, using OneDrive in Linux with rclone takes some effort. If you want an easy way out, get a GUI tool like Insync. and use OneDrive natively in Linux.

I hope you find this tutorial helpful. If you have any questions or suggestion, we’ll be happy to help you out.

How to use rclone to back up to google drive on linux

Sumeet

Computer engineer, FOSS lover, lower level computing enthusiast. Believe in helping others and spreading knowledge. When I get off from computer (it rarely happens) I do painting, reading and watching movies/series. Love the work of Sir Arthur Conan Doyle, J. R. R. Tolkien and J. K. Rowling. BTW, I use Arch.

Like what you read? Please share it with others.

Rclone is a command line cloud storage synchronization program that allows accessing and synchronizing files between your filesystem and cloud storage services, or between multiple cloud storage services. Recent versions also come with a Web GUI, and there are third-party GUIs available as well, like Rclone Browser.

The tool supports many cloud storage providers like Amazon S3, Box, Dropbox, Google Drive / Photos / Cloud Storage, Mega, Microsoft OneDrive (personal and business), pCloud, Yandex Disk and more. It’s available for Windows, macOS, Linux and *BSD.

This article shows how to encrypt cloud storage files from a remote (a remote is a cloud storage provider that’s configured in Rclone) using Rclone. It assumes you’ve already added some cloud storage providers to your Rclone configuration; if not, download and install Rclone, run rclone config , choose New remote and add Google Drive, OneDrive or any other cloud storage supported by Rclone.

For encryption, we’ll use the crypt Rclone remote. It’s worth noting from the start that only the files copied / synchronized to the crypt remote will be encrypted, so you can continue to upload unencrypted files if you wish, exactly as before; this also means that any files previously uploaded to the cloud storage are not encrypted, and this will not encrypt them unless you delete the files from the cloud storage and then store them in the new crypt remote.

The Rclone crypt option can encrypt the files, file names (standard file name encryption or simple file name obfuscation) and directory names. The file length and modification time are not encrypted.

Also check out Cryptomator, another cross-platformtool to encrypt cloud storage (and more) files.

How Rclone cloud storage encryption works

First I’ll show you how this works, and then I’ll tell you how you can encrypt your cloud storage files using Rclone.

Say I have a backup file called backup.tar.gz on my computer, and I want to upload it encrypted to OneDrive, in a folder called Backups. To achieve this I create a Rclone crypt remote (called encrypted: ) which encrypts a remote path set to onedrive:Backups .

So when I copy this backup.tar.gz file to encrypted: , it will be uploaded as encrypted in my OneDrive Backups folder:

Now when I list the files in the onedrive:Backups remote folder, this file shows as encrypted:

If I list the files in the encrypted: remote, I can see this file as decrypted:

In case I need this file, I can copy it to my computer from the encrypted: remote as follows (the file will be copied as decrypted on my computer, in

/ which is the home folder):

So whenever I want to access this file, I’ll need to access the encrypted: remote via Rclone. The OneDrive website has this file encrypted so it can’t be used until it’s decrypted using the Rclone crypt remote.

Rclone Browser, a cross-platform Qt GUI for Rclone, supports crypt remotes, as well as an encrypted Rclone configuration file, so you can continue to use it with encrypted files.

Create a crypt Rclone remote to encrypt cloud storage files

1. Create a “crypt” Rclone remote by opening a terminal and typing:

You’ll now be asked what you want to do next:

Enter n to create a new remote.

2. You’ll then be asked to enter a name for the new remote – I went with encrypted for the name:

3. Now you’ll need to choose the type of storage to configure:

Type crypt to create a new crypt storage type.

4. Next, you’ll need to enter the remote path to encrypt/decrypt. For example if you created a remote for OneDrive with the name onedrive , and you want to encrypt the contents of the Backups folder inside this OneDrive remote, you’d use onedrive:Backups here:

Everything contained in the path you enter here will be encrypted, and anything outside will not be encrypted.

In case you don’t know how you’ve called your cloud storage remote(s), you can open a terminal and type this to list all the remotes configured in Rclone:

5. The next step is to choose how to encrypt the filenames, and you can go with either standard, simple filename obfuscation or not encrypting the filenames. The standard filename encryption will produce longer filenames, and some cloud storage providers may have a filename length limitation, so keep this in mind. Choose the option that best suits your needs (I chose standard below):

6. In the next step, you can also choose to encrypt the directory names (type true or 1 ), or leave them intact (type false or 2 ):

7. Next you’ll be asked to enter a password or generate a random one for your encrypted cloud storage files. Make sure you don’t lose this password! The password is stored in the Rclone configuration file (which can be encrypted as you’ll see a bit later) so you don’t have to type it every time you want to access your encrypted files, but in case you lose the Rclone configuration file you’ll need this password to decrypt your cloud storage files!

I choose to enter my own password ( y ), and in this case I had to enter the password twice:

8. Now you’ll be asked to enter a password for salt (or generate a random password), or leave this blank. This second password is used by Rclone in conjunction with scrypt, which makes it impractical to mount a dictionary attack on the Rclone encrypted data, and it’s recommended you set a password for full protection.

Here I entered g , which tells Rclone to generate a random password:

9. Since Rclone will generate the password for you, it next asks you to enter the password strength in bits. I recommend going with 1024 for maximum password strength:

10. Rclone will now reveal the generated password and ask you if you want to use it (type y or just press the Enter key if you are ok with the new password). Once again, make sure you don’t lose this password, so store it somewhere safe, like a password manager (I recommend Bitwarden):

Rclone will now print your configuration, and ask you if it’s ok – press Enter to confirm it:

How to encrypt the Rclone configuration file

The Rclone encryption password is stored in the configuration file, and is only lightly obscured. To secure it, it’s recommended you encrypt the Rclone configuration file.

This can be done very easily from the Rclone configuration. Type:

This presents the currently configured remotes, followed by some options:

Type s and press the Enter key to set a configuration password.

In the next screen you’ll see:

Type a , and you’ll be prompted to enter the Rclone config password:

Once you type your new Rclone configuration password twice, type q to quit.

How to use rclone to back up to google drive on linux

ETdoFresh

How to use rclone to back up to google drive on linux

ETdoFresh

Introduction

I was trying to use Synology’s Hyper Backup and it was taking months and still no results. So I gave up and decided to setup an rclone dokcer on my Synology NAS to sync my data to Google Drive. Here are the steps I took…

Setup Folders

Create a folder where you will store your rclone/google-drive configuration ex. /docker/rclone

How to use rclone to back up to google drive on linux

You will also need to know which folder you want to backup or sync. I’m doing a backup, but similar steps can be taken for sync. ex. /ETdoFresh/sync

Download Docker rclone Image

Download the rclone/rclone Docker Image from the Registry

How to use rclone to back up to google drive on linux

Launch rclone Image

Launching an image creates a docker container. Launch the rclone/rclone Image. Click on Advanced Settings.

How to use rclone to back up to google drive on linux

Mount the following volumes under the Volume tab. ex. ETdoFresh/sync => /sync ex. docker/rclone => /config/rclone

How to use rclone to back up to google drive on linux

Enter config under Command in the Environment Tab.

How to use rclone to back up to google drive on linux

Apply. Next. Apply.

Running the Configuration

At this point, rclone has already prompted you to enter an option. To verify this, check Logs and then goto Terminal.

How to use rclone to back up to google drive on linux

How to use rclone to back up to google drive on linux

Here is the console output of a succesful transaction:

Verify Configuration

You should now have a rclone.conf in your configuration directory.

How to use rclone to back up to google drive on linux

Change Command Line

Now we will change the command line from configuration to backup. To do this, we edit the rclone-rclone1 container to…

Well, I just found out, you can’t change the command line 🙁

So, repeat [Launch rclone Image](Launch rclone Image) using the following instead of config on the last step…

Arguments and their descriptions can be found here:

Conclusion

This is the first steps to getting rclone working with your synology. The setup we have is manual. You have to run the docker everytime you want to backup. It will then shutdown when complete.

If you want to automate this, here are some options.

  1. Check the Enable auto-restart option in EditHow to use rclone to back up to google drive on linuxThe info is particular interesting as it will slow down when there is nothing to sync. It’s what I have currently setup, but will probably do Option #2 in the future.
  2. Extend the rclone/rclone Docker image to use crond/crontabs to schedule a nightly backup.

More in Rclone

How to use rclone to back up to google drive on linux

Closing the Old, Starting the New

I decided to use GitHub Issues. This way, I see everything I have to do in one screen. However, I had many old issues hannging out. I had to bite the bullet and admit to myself I probably won’t do these.

Last updated September 27, 2019 By Munif Tanjim 55 Comments

How to use rclone to back up to google drive on linux

Brief: While Google Drive is not officially available for Linux, here are tools to help you use Google Drive in Linux .

Google Drive is an integral part of the Google ecosystem. It offers 15 GB of free storage which is shared across your Gmail account, Google Photos, various Google and Android services. Since its debut in 2012, we’ve seen official Google Drive clients for Windows, OS X, Android, iOS.

But, unfortunately, an official Linux client is yet to see the light of the day, if ever. This deliberate and continual ignore by Google has prompted Linux users to question if Google hates desktop Linux?

However, in the world of Linux, there’s always an alternative or workaround. Here we’re going to see such alternatives ways you can use Google Drive in Linux .

Best tools to use Google Drive in Linux

The list here is no particular order. I have just listed a few Google Drive desktop clients for Linux along with some other hacks.

1. Insync

How to use rclone to back up to google drive on linux

Insync is the most feature-rich Google Drive desktop client available out there. You’ll find almost everything you want from a Google Drive client in it, including multiple account support, desktop notification, symlink support etc.

It’s available for all major Linux distros and the installation process straightforward. It offers a beautiful GUI as well as the command-line interface.

The only downside is that Insync is not free. Insync provides a 15 day free trial period. After that, it’ll cost you about $29 one-time payment for a single account and for multiple accounts, Insync has per-year pricing plans. If you have no problem with that, we can safely say that Insync is the Google Drive desktop client you’re looking for.

2. overGrive

overGrive is yet another feature-rich Google Drive desktop client. It includes almost all the features from Insync with some exceptions, such as no symlink support. It provides a nice GUI and an interactive setup process. overGrive supports all major Linux distros and desktop environments. It’s also available in multiple languages.

Though overGrive is not free, its price is far less than that of Insync. The license fee for overGrive is only $4.99. It can be a good choice for Google Drive desktop client.

3. Rclone

Rclone is actually more than just a Google Drive client. It is a command-line program to sync files and directories to and from various cloud storage services, including Google Drive, Dropbox, Amazon S3, OneDrive etc. The installation and usage documentation can be found on their official website. For configuring Google Drive with Rclone, read this.

It’s completely free and open source. You can find the source code in the GitHub repository of Rclone. If you are comfortable working with the command-line interface, you can pick this one.

4. Drive

This one’s a little bit interesting. Drive was originally developed by Burcu Dogan, while working on Google Drive platform’s team. So, this is the closest thing we have to an official client.

It’s a command-line tool written with GO programming language. It doesn’t have background sync feature. It’s designed to upload/download files in a push/pull style. Frankly, it’s a little difficult to use it for everyday purposes. You’ll find a complete guide for Drive on its GitHub project.

Platform specific installation methods can be found here.

5. GNOME (version 3.18+)

If you use GNOME as your desktop environment, you’re in luck. Starting from version 3.18, GNOME has baked in a Google Drive feature in their file manager Nautilus.

If you add your Google Account in GNOME Online Accounts, Nautilus will automatically have Google Drive added to its sidebar as a remote filesystem. It’s not actually a desktop client. But you can do some cool things like drag&drop file uploading, opening Google Drive files directly from Nautilus, copying files from Google Drive to your local filesystem etc.

Your pick?

It’s totally disappointing that Google hasn’t yet come forward with an official Google Drive client for Linux despite the growing popularity of Linux. Until it does, these alternatives are all we have.

Which one of these is your favorite? Do you have any other suggestions to use Google Drive in Ubuntu or any other Linux? Are you facing trouble using any of these methods? Whatever the reason is, you’re always welcomed to use our comment section.

Like what you read? Please share it with others.

Please double check the address you were trying to hit, or let us know if we can help point you in the right direction.

QUICK LINKS // More Section offerings

Edge Modules

  • Varnish Cache
  • Nginx/Lua
  • SiteSpect
  • Optidash
  • Cloudinary
  • ModSecurity
  • SignalSciences
  • ThreatX
  • Wallarm
  • Snapt
  • PerimeterX
  • Radware Bot Manager
  • Content Security Policy
  • Virtual Waiting Room
  • Hugo
  • Node.js
  • Custom Workload
  • View All Modules

DevOps

  • Real Time Metrics
  • Log Management
  • Real User Monitoring
  • Instant Global Deployments
  • Developer PoP
  • Instant Cache Purge
  • Managed SSL Certificates
  • APIs

Endpoints

  • Global Edge Network
  • Custom Edge Network
  • Private Edge Network
  • Origin PoP

Performance & Scalability

  • Dynamic Content Caching
  • Static Asset Caching
  • HTML Streaming
  • Anonymous Page Caching
  • Image Optimization
  • Mobile Optimization
  • Virtual Waiting Room
  • HTTP/2

Edge Delivery

  • Load Balancing
  • Maintenance Pages
  • Anycast DNS Hosting
  • SSL Certificates
  • Static Site Deployment

Application Security

  • Web Application Firewall
  • IP Blocking
  • SSL Certificates
  • DDoS Mitigation
  • Bad Bot Management
  • Content Security Policy

Use Cases

  • SaaS
  • PaaS & Hosting Providers
  • Edge App Hosting
  • Enterprise
  • E-Commerce
  • Gaming
  • IoT/IIoT
  • BigCommerce
  • Magento
  • WordPress
  • Drupal

Join our Slack community

Company

  • About
  • Careers WE’RE HIRING
  • Legals

Resources

  • Blog
  • Case Studies
  • Content Library
  • Solution Briefs
  • Partners
  • Changelog

Support

  • Docs
  • Community Slack
  • Help & Support
  • Platform Status
  • Pricing

Section supports many open source projects including:

LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Sunday, July 26, 2020

Install Rclone on Debian/Ubuntu

as usual, update & upgrade server

sudo apt update && sudo apt upgrade

sudo apt install rclone -y

Adding new remote

Once you have installed rclone successfully, you need to configure rclone. Enter the following command in the terminal:

rclone config

If it’s your first time using rclone, you have to add a new remote to rclone. Select ‘n‘ to add a new remote.

Now you have to enter the name of the remote. You can enter any name here that matches the cloud service so that it is easy to identify. I am using ‘Gdrive‘.

Select cloud service you want to sync with rclone

After entering the name and hitting enter, you will see a list of cloud services like Google cloud storage, Box, One Drive, and others.

You have to enter the number of the service you want to use. In this case, it’s ‘Drive’. Make sure you enter the correct number.

As you don’t need to enter client ID or secret ID hit Enter twice.

Choose the permission type and number

It will ask root folder ID and Credentials JSON file path just hit enter twice

Next enter ‘N’ for selecting no for advanced configuration. Of course, if you want to configure something very specific, you can go ahead with Y.

When you’re asked for ‘Use auto config’, press Y.

Login to Google Drive account

When you enter ‘y’ and hit enter, you will get a link, open it in a browser and here you have to log into your Google account. And if it asks for permission click on ‘yes’. and copy the code and paste it on the terminal.

How to use rclone to back up to google drive on linux

Google drive is a great FREE cloud storage service. It allows you to store your data in the cloud so you can access it anywhere in the world, from just about any device. In this Linux Quick Tip we will show you how to easily mount your Google Drive using Gnome Online Accounts. Once mounted, you can access, copy, and delete your files from the GUI or the command line.

Set Up Google Drive in Gnome Online Accounts

Let’s fire up Gnome Online Accounts and add our account. Go to Settings > Online Accounts to access the Add an account screen pictured below.

How to use rclone to back up to google drive on linux

Click on Google and you will be asked to provide your gmail user account credentials. pass two factor authentication if enabled, and grant Gnome access to your account.

How to use rclone to back up to google drive on linux

Once you are authenticated, you will be asked what features you want access to. You can select whatever you want here. Some of my friends like to enable everything so they can use the Gnome native apps. Since this article is about mounting Google Drive in Linux, we only need to ensure Files is turned on. Make sure the switch next to Files is on, and click the x to close the dialog box.

How to use rclone to back up to google drive on linux

Now you will see that your Google account is connected. Once you are at this point, you are ready to start using Google Drive.

Access Google Drive From Linux GUI

Now that your account is active, you can start using Google Drive. If you open “Files” you will see a new drive on the left menu with your gmail address as it’s name. This is your Google Drive and you can copy, delete, and rename files from it just like you would any other folder.

How to use rclone to back up to google drive on linux

Now that you can access Google Drive from your desktop, so can all of your apps. You can use your favorite backup tool (Deja Dup?) to copy your important files to Google Drive.

Access Google Drive from Linux Command Line

Here is where this became really useful for me. I wanted to access Google Drive from the command line so I can use rsync to synchronize my Documents directory with Google Drive.

Gnome uses it’s gvfs (GNOME Virtual file system) to mount Google Drive with your account. The default location for a gvfs mounted drive is /run/user/ /gvfs/ / . Of course you have to replace with your UID and with the Google Drive connection name.

You can your UID by using the echo command like so:

Or you can use the following command to add it on the fly:

Here is it in action:

As you can see above, Google Drive doesn’t show the “display-name” of the file, but rather the ID of the file. This can make it hard to know what file you are going to be accessing. You can get a list with the filenames by using the gio command.

Because I use this so often, I created an alias to quickly get a listing. I added the following to my

Now I can just lg when I want a listing with the common names.

Now that I have this setup, I use rsync to synchronize my Documents folder with Google Drive. Now no matter where I am I can log into my gmail account and have access to all my documents. If you are interested in how this works leave a comment below!

Conclusion

There you have it, a simple method for connecting and mounting your Google drive on your Linux system. I use this every day and love it.

How to use rclone to back up to google drive on linux

Copying data between servers is the backbone of any System Admin job. Data has to be correct without any errors and accessible to those who needed it. In the distant past, admins could use Rsync to copy data between servers via the Terminal, but with the advent of Cloud computing and storage, now data can be spread over several services and used by hundreds of individuals. This is where Rclone comes into play.

Rclone is Rsync for multiple cloud based storage. It is a Terminal-based utility that syncs folders and files not only to the local filesystem, but also to Google Drive, OneDrive, Dropbox and Amazon, among others.

Set Up

Rclone is available as source from the site or within most repositories of major Linux distributions. As I use Ubuntu, it was just a case of installing it via the Terminal:

How to use rclone to back up to google drive on linux

Once installed, users need to make some configuration changes. Enter the following:

You will be presented with the following screen:

How to use rclone to back up to google drive on linux

The terminology is a little ambiguous, but for this we want a new connection, so we choose ‘n.’ The terminal will move along and ask you to select the storage provider type that you want to use. In this case, Google Drive.

How to use rclone to back up to google drive on linux

Rclone will then ask if you want an auto setup. I selected “yes,” and it gave me a link to open. This will lead you to your provider login, so that you can authorize Rclone to use the service.

How to use rclone to back up to google drive on linux

The Terminal will then report success and ask if you want to continue and provide access token details, which I obviously won’t screenshot. One final thing to do is to encrypt your connection and password. This is generally a good idea, as passing the information in plain text is not advised.

How to use rclone to back up to google drive on linux

With the encryption set, you can type the following to list your cloud files. Note that you need to use the name of the storage you selected, so in my case this was “Google,” but you may have called it something else. I would advise sticking to the company or brand name, especially if you have several cloud storage accounts.

This will pull every file that you have, which for some users will be a huge amount, so it is better to search by Directory using:

Using Rclone

Now you can copy files to the cloud storage by entering the following commands from the Terminal:

In the above example I wanted to copy the screenshots for this tutorial into the a folder called “Toshiba” within my Google Drive. The screenshots below show the local files and then the files as they are within my cloud storage. Change the above command “path/to” for the directory you want to copy. For instance, in my case it was:

How to use rclone to back up to google drive on linux

How to use rclone to back up to google drive on linux

Rclone can also delete files and directories and can be found within the online documentation.

Rclone provides a quick and relatively safe way for users to back up essential files from the Terminal. Whether or not it still has a place within the Linux toolset can be argued. Personally, I find it useful, but less experienced users may struggle with the setup and GUI-less environment. What is your favourite method of backing up? Do you use Rclone, or do you prefer more conventional methods? Let us know in the comments section.

Matt has worked in the tech industry for many years and is now a freelance writer. His experience is within Windows, Linux, Privacy and Android.

  • Facebook
  • Tweet

Affiliate Disclosure: Make Tech Easier may earn commission on products purchased through our links, which supports the work we do for our readers.