Google Drive Regular Backup with RCLONE

Hello,

I will try to describe it step by step, I hope we can do it without any problems.

First of all to install rclone:

sudo -v ; curl https://rclone.org/install.sh | sudo bash

Then let’s go into the rclone settings and make our google drive connection:

rclone config

Wait here and on the other hand login to google console, enable Google Drive API and create an app, it can run in test mode but don’t forget to register the email address of your drive account to the test user. Then we can get client id and client secret and continue with rclone config.

During the process rclone will ask you two options for google authentication.

Pay attention here if you are connecting to the remote server via ssh:
The terminal will give you a code.

example:

For this to work, you will need rclone available on a machine that has a web browser available.
On a machine with a web browser, apply the following line of code to the terminal:
rclone authorize “drive” "98cf15cf1fcee428047b6b97eabf5610fb5f13fd1d7a903b886013fe1a554b2ecc3e81c88047b6b97eabf5610fb5f13fd1d7a903b80fb5f13fd1d7a903b8cf15cf1fcee428047b6b97eabf5610fb5f18cf15cf1fcee428047b6b97eabf5610fb5f1 "

and the terminal will ask you for a token to enter. When you enter the in the browser, do the verification and add the token you will receive to your server in your terminal waiting for the token via ssh. This will complete the rclone verification.

When you create a google drive with rclone, the name you give it is “for example: gdrive” and google drive folder name it is “/hestiabackups
We will use it in cron processes:

rclone copy /backup/ gdrive:/hestiabackups --include "*.tar" 
rclone delete --min-age 72h gdrive:/hestiabackups --include "*.tar"

The folder mentioned here is our folder /hestiabackups in the drive, so the process first backs up the .tar files, then deletes the tar files older than 3 days from the drive.

Also to retrieve backups of the last 24 hours to the server:

rclone copy gdrive:/hestiabackups /backup/ --include "*.tar" --max-age 24h
2 Likes

Just run rclone config

2 Likes

Thanks for this post @hadsizefendi I have wanted to backup my HestiaCP instances to Google Drive for some time. Will follow the process and see where it lands.

1 Like

In case of the TS host will be “gdrive”

/hestiabackups will directory

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.