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. Update: I prefer nomachine over x2go, but that has to be downloaded as a .deb from their website and installed.
  6. adduser nikhil
  7. usermod -aG sudo nikhil 1
  8. usermod -aG admin nikhil 1
  9. Copy your SSH public key to /home/nikhil/.ssh/authorized_keys.
  10. systemctl restart x2goserver
  11. 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/NoMachine. 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 you are using another computer to log in, remember to add that public key to the Droplet when creating it. The key may still not be present in the normal user’s authorized_keys file. So login as root to the Droplet and add the public key to the user’s authorized_keys.
  3. If the IP has changed (very likely), edit the x2goclient/nomachine config with the new IP.
  4. Connect to Remote Desktop.
  5. Log in to your Google Account via the remote desktop and download all Takeout files to a folder google-takeout/.
  6. SSH into the droplet with the same user.
  7. 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.
  8. rclone lsl b2: to verify the result. lsl shows sizes and timestamps. This recurses by default.2
  9. 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. ↩︎

  2. The B2 website “Browse Files” can take up to 24 hours to update. ↩︎