Filip Troníček

A little weird 15-year old who loves JavaScript and Python for a better world with OSS

Home

Backing up & backing down

Published Oct 29, 2020

Hello, today’s blog post is all about backing up stuff to the cloud and also having copies at home locally. Doing this is very important since it is crucial to keep your data alive even when something bad happens. To do all of this, we will be using rclone, which is an awesome open-source tool for doing stuff with cloud storage.

You can use rclone with all of these services, the process will be very similar to the one I will be using (Google Drive & Google Photos):

Picture of table

Setup

Install rclone

First, install rclone, this is fairly easy:

  • On Linux based systems, execute curl https://rclone.org/install.sh | sudo bash
  • On Windows, download with Chocolatey (choco install rclone) or download it from their Downloads page
  • On macOS, use brew install rclone with Homebrew or also head to their Downloads page for the installer

Configuring rclone

Keep in mind, I will be setting up Google Drive in this example, but other apps are set up similarly.

  1. Open the terminal, and in your shell execute rclone config
    Picture of output
  2. Choose the option n for a new remote
  3. Choose a simple name (can be anything you want)
  4. Fill in the number corresponding to the storage option you want to use (this is remote) Picture of output
  5. If prompted for any platform-specific details, fill them out, but for Google services, you don’t have to fill in the Client ID and the Client secret.
  6. Grant full access
    Picture of output
  7. Enter the ID of the root folder, this can be nothing, or the end part of the URL when browsing your Drive.
  8. Leave the service account field empty
  9. Skip through the next 2 steps with the Enter key
  10. You will then be prompted to sign in with your default browser
    Auth
  11. Grant access to the requested resources
    Auth
  12. Select n to not configure as a team drive
  13. You are done!

Downloading and uploading

An example use case (which I use) is backing up my stuff from my computer to Google Drive, that command would like like this:

rclone copy --update --verbose --transfers 25 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s "/mnt/c/directory" remote:

To download from the remote (for example to keep a copy of all your Google Photos or Onedrive documents locally), just switch out the remote and the source path

Thanks for reading!