Using a Digital Ocean Droplet to backup Google Takeout to Backblaze B2
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.
- Create a Droplet with 4-8GB of RAM so we can run a desktop and a browser. I just picked the default Ubuntu.
- Set up your SSH keys.
- SSH as
root
. apt update && apt install rclone xubuntu-desktop x2godesktopsharing
- this seems to also install Firefox.- Update: I prefer
nomachine
overx2go
, but that has to be downloaded as a .deb from their website and installed. adduser nikhil
usermod -aG sudo nikhil
1usermod -aG admin nikhil
1- Copy your SSH public key to
/home/nikhil/.ssh/authorized_keys
. systemctl restart x2goserver
rclone config
- Now follow the instructions to get B2 setup below. I call this remote justb2
.
Backblaze B2 bucket setup
- Use the B2 website to create a bucket for your Takeout data.
- Create an Application Key with read-write access to this bucket.
- Finish the
rclone config
setup above with the application key details.
Remote desktop
- On your laptop/home computer install
x2goclient
/NoMachine. On ChromeOS, this issudo apt install x2goclient
in the Linux container. - 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.
- 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.
- Create the Droplet from the snapshot (in the Images tab).
- 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 asroot
to the Droplet and add the public key to the user’sauthorized_keys
. - If the IP has changed (very likely), edit the x2goclient/nomachine config with the new IP.
- Connect to Remote Desktop.
- Log in to your Google Account via the remote desktop and download all Takeout files to a folder
google-takeout/
. - SSH into the droplet with the same user.
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, usecopy
.rclone lsl b2:
to verify the result.lsl
shows sizes and timestamps. This recurses by default.2- 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.