I have a private server in the cloud, and I want to backup my home directory which has docker container config, volumes, and services files. I used rclone tools for backing up my files synchronously to google drive. The documentation available on https://rclone.org/.

In this article, I want to show you how I configured and run the rclone for my Ubuntu 20.04 server.

Rclone Installation

Run command below using terminal

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

wait until finished, figure below shows output of successful installation.

Configure rclone

This step allow me to add new remote, I choose google drive for my cloud storage backup. The procedures is only done once, then if I have any google drive account that i can use for backup, I will follow this step again.

Run command below using terminal

rclone config

The new CLI prompt application will appear, now I just follow the instruction given.

The step I did are :

  1. N
  2. Type remote name; ZeroServer-SG.
  3. 13
  4. client_id > Skip
  5. client_secret> Skip
  6. 1
  7. Root_folder_id > Skip
  8. Service_account_file > Skip
  9. Auto config? > n
  10. Open the link given using browser, allow, and get credentials access to my google drive account then copy to my terminal.
  11. As team drive? > N
  12. Confirm > Y

Start to Synchronize file

Before doing it, I make sure the permission of every files in the home/zero is with ‘zero’ owner. If not the rcclone will not sync that files.

To change all permission, I run

sudo chown -r zero /home/zero

After that I can sync my home files using rclone sync command by run following command

rclone sync -i /home/zero ZeroServer-SG:ZeroServer-SG-Backup -v

the command will sync all files and folder in /home/zero to the ZeroServer-SG remote. It takes long time to finish, depends on the file sizes and total files queue .

Look at the drive folder, our server files successfully synchronize.

I need automatic syncronize the file everyday, so I add the command to cron job.

Run following command open cron job.

crontab -e

add code below on last line

0 0 * * * rclone sync -L /home/zero ZeroServer-SG:ZeroServer-SG-Backup > /dev/null 2>&1

Finally, it will run synchronize command every midnight automatically.

Loading