Tips to Back Up to Google Drive on Linux Using With Rclone

Tips to Back Up to Google Drive on Linux Using With Rclone

Hello Geeky, so today we are focusing on How to Back Up to Google Drive on Linux Using With Rclone. So please read this tutorial carefully so you may comprehend it in a better helpful way.

Guide: How to Back Up to Google Drive on Linux Using With Rclone

Rclone is a command line application for managing files on the cloud storage. It supports 40+ cloud storage products including the best cloud storage services from Google, Amazon, Dropbox, Mega, Microsoft, Zoho and pCloud. Available for Linux, Windows, MacOS, Debian, OpenBSD and many other operating systems, Rclone is the Swiss military knife for cloud storage. It is a versatile application, but the most common Rclone role is to act as a bridge between different cloud storage providers so that you can easily move, copy and synchronize files between providers.

So far, Google has not yet launched an official backup / synchronization client for Linux, and as a frequent WSL2 user, I am looking for a solution that will automatically download backups from the WSL2 Linux file / distribution to Google drivers. Linux and the development of WSL2 (with a real Linux kernel) make it easy to operate in a virtually “real” Linux environment without the need for third-party power software. Using rclone with WSL2 allows me to restore project files from a recent backup if I accidentally throw my Linux WSL2 distribution in the trash, the only restriction is that no file can exceed 5TB).

Download / install rclone:

To download / install rclone:

    • $ cd $ HOME
    • $ curl https://rclone.org/install.sh | sudo bash
    • rclone v1.53.1 has been successfully installed.

Before we are able to configure access for rclone to our Google Drive account, we need to activate the Google Drive API and create the necessary credentials.

Activate the Google Drive API:

  • Sign in with your Google account at: https://console.cloud.google.com to start the process for running the API.
  • Navigate to “APIs & Services” → “Library”.
  • Find and activate the “Google Drive API”.
  • Select “Create Certificates” and proceed to the next section for configuring the Oauth Certified screen.

Create Google Drive API credentials for rclone:

From the left side of the cloud console, select “Oauth consent screen” and configure using these values.

  • User type: External -> Create.
  • Application name: rclone.
  • Support email: enter your google email account.
  • Add the following fields: “Google Drive API” ->… / auth / drive ”.

From the left, select “Create Certificates”

  • Click on the menu “+ Create certificates” and select “Oauth customer ID”.
  • Application type: Desktop app.
  • Name: rclone.
  • Click “Create”.
  • Customer ID & customer privacy will be generated. Consider these as they are needed during the rclone setup process.

Setting rlone

Start the clone setup by running:

    • $ rclone config

During the setup process, select / enter the following options:

  • n to install a new remote.
  • name: gdrive.
  • From the list of storage providers select the number / option that corresponds to Google Drive “drive”.
  • Google application customer information: as observed from Google configuration.
  • customer privacy: as noted from Google’s configuration.
  • expires: 1 / Full access to all files, without Application Data Folder. “drive”.
  • root_folder_id: empty.
  • service_account_file: empty.
  • edit advanced configuration: N.
  • remote configuration use automatic configuration: Y.
  • Open the generated URL link with your browser and complete the verification process.
  • After successful verification and granting permissions to rclone, return to the rclone shell terminal to continue setting up.
  • drive group: N.
  • Y to confirm the normal configuration.
  • Select q to complete the setup.

Select the appropriate rclone command: copy or synchronize

Depending on your backup requirements, you can choose from many different command options. Among these is the creation, synchronization.

Copy

    • rclone copy source: sourcepath dest: destpath

The following command:

    • $ rclone creation – Moving 20 – 5 reviews ”/home/ dev / g ”“ gdrive: / mybackup ”

can be used to back up the contents of the subdirectory area /home/ dev / g to Google drive gdrive mode: / mybackup, where gdrive is a reference to the Google drive alias as provided during the rclone configuration process, and / mybackup is a location within our Google root directory. The flags selected in the order above mean the following:

    • Transfers: number of file transfers to make in parallel (20)
    • -trys: the amount of time to try again failed projects (5)

Synchronization

    • rclone synchronization REMOTE SOURCE: DESTINATION

For the next exercise example, we will use the rclone creation option. Press with caution if you decide to use the synchronization option. Misunderstandings about how the synchronization command works can lead to loss of data.

Exercise clone command with fold and cron

The rclone creation command in the previous section can be implemented as a cron job, set to run at desired intervals. Before we go into the configuration, we need to address the situation where the backup may still work while the next system example is due to startup. An easy way to manage this scenario would be through the idea of ​​locking the Advisory file with the herd. As a human page for a herd, we can use a herd order to implement our rclone backup.

  • $ flock -n /tmp/google_drv_sync.lock / usr / bin / rclone Creating -Bringing 20 –retries 5 ”/home/ dev / g ”“ gdrive: / mybackup ”

The above command prompt will create the google_drv_sync.lock file (if not already available) and get the exclusive lock (write) on file for the duration of the clone backup. Option -n tells the group that in case where the lock cannot be received (ie the previous backup is still running), exit immediately with the return code 1 (ie do not wait for the lock to be released).

Faq

Guide about How to Back Up to Google Drive on Linux Using With Rclone


In this guide, we told you about the How to Back Up to Google Drive on Linux Using With Rclone; please read all steps above so that you understand How to Back Up to Google Drive on Linux Using With Rclone in case if you need any assistance from us, then contact us.

How this tutorial or guide assisting you?


So in this guide, we discuss the How to Back Up to Google Drive on Linux Using With Rclone, which undoubtedly benefits you.



Final note

I hope you like the guide How to Back Up to Google Drive on Linux Using With Rclone. In case if you have any queries regards this article/tutorial you may ask us. Also, please share your love by sharing this article with your friends and family.

Tips to Back Up to Google Drive on Linux Using With Rclone
Tips to Back Up to Google Drive on Linux Using With Rclone
Trickbugs: Get the latest Trick and Tips
Logo
Enable registration in settings - general