Using a Digital Ocean Droplet to backup Google Takeout to Backblaze B2

Posted on Jul 7, 2021

Notes on using a Digital Ocean Droplet to copy Google Takeout data to Backblaze B2, for my own reference and in case they are useful to others. This uses rclone to perform the sync.

Google Takeout allows exporting all your Google data, but requires a modern browser, with GUI and JS. The total data can be huge (~36GB for my last export), so downloading it to my local machine and uploading it can be slow (even on a Gigabit connection). Instead, this approach uses a remote machine to perform the sync.

This was inspired by this post but I already had a Digital Ocean account, and find it a lot easier to use than AWS.

One Time Setup

Digital Ocean setup

The machine is set up with XFCE, X2Go (I tried xrdp and it was really slow), and rclone.

  1. Create a Droplet with 4-8GB of RAM so we can run a desktop and a browser. I just picked the default Ubuntu.
  2. Set up your SSH keys.
  3. SSH as root.
  4. apt update && apt install rclone xubuntu-desktop x2godesktopsharing - this seems to also install Firefox.
  5. adduser nikhil
  6. usermod -aG sudo nikhil 1
  7. usermod -aG admin nikhil 1
  8. Copy your SSH public key to /home/nikhil/.ssh/authorized_keys.
  9. systemctl restart x2goserver
  10. rclone config - Now follow the instructions to get B2 setup below. I call this remote just b2.

Backblaze B2 bucket setup

  1. Use the B2 website to create a bucket for your Takeout data.
  2. Create an Application Key with read-write access to this bucket.
  3. Finish the rclone config setup above with the application key details.

Remote desktop

  1. On your laptop/home computer install x2goclient. On ChromeOS, this is sudo apt install x2goclient in the Linux container.
  2. Launch x2goclient and create a new session config. The Host is your Digital Ocean droplet IP and the SSH key is the private key (lost several minutes because I accidentally put my public key here). Select XFCE as the desktop.
  3. You should now be able to connect using x2go and get a remote desktop.

Power off and snapshot the Droplet

We don’t want the droplet running except the couple of minutes it takes to back up. In addition, even powered off Droplets are still charged. Instead, it is cheaper to store as a snapshot and re-create a new Droplet from a snapshot. So power off the droplet. Then create a snapshot. Once the snapshot is ready, destroy the droplet. Digital Ocean estimates it will charge me $0.22 per month for the snapshot.

Every time you want to backup a Takeout

You can set Takeout to schedule backups at a frequency. It will then email you when the backups are ready to download.

  1. Create the Droplet from the snapshot (in the Images tab).
  2. If the IP has changed (very likely), edit the x2goclient config with the new IP.
  3. Connect to Remote Desktop.
  4. Log in to your Google Account via the remote desktop and download all Takeout files to a folder google-takeout/.
  5. SSH into the droplet with the same user.
  6. rclone -vP sync google-takeout/ b2:your-bucket-name. NOTE: sync will delete old files. This is the behavior I want since each Takeout contains all your data ever, so older Takeouts can be deleted. If you do not want this, use copy.
  7. rclone lsl b2: to verify the result. lsl shows sizes and timestamps. This recurses by default.2
  8. Destroy the droplet for security and to save money. This will ensure you are logged out of your Google Account and your Takeout files are not lying around on the Droplet.

  1. May not be really required. [return]
  2. The B2 website “Browse Files” can take up to 24 hours to update. [return]