I’ve started doing physical backups of my network and cloud storage. That’s potentially a whole other topic, but here’s an overview:
I have a Sabrent USB SATA dock and two 10tb hard drives. Every month-ish, I use rclone (similar to rsync on Linux) to sync over only the files that changed. This ensures that if anything happens to anything, I have a backup copy.
For Google Drive, I use the Windows app, which mounts my Google Drive account as a G: drive. (This is helpful for everyday use, not just backups. For example, I sync my Obsidian vaults with Google Drive as well.) There’s just one problem: you can’t copy Google documents, sheets, slides, maps, etc. to your local hard drive.
The Google Apps Script solution
In my last post I talked about setting Google Drive permissions in bulk using Google Apps Script, and it’s helpful here, too. (If you want to get started with Google Apps Script, check that post for a quick overview.)
The APIs for Google’s various document services allow you to convert to Microsoft Office format, which Google Drive will also read. (In the case of maps files, I convert them to KML, which can be imported into Google maps.)
Here’s the gist to automate it, which does the following:
- Search for all files matching a particular MIME type.
- Ensure that each file is in your Google Drive, not in the trash, and owned by you
- Check for the existence of a “filename.backup.ext” version of each file (where ext is the Microsoft Office extension)
- If the backup is newer than the last modified date on the original file, skip it
- Otherwise, delete the backup file
- Create a “*.backup.ext” version of each file by making an HTTPS call to the Google app that saves it to the associated Microsoft Office format.
Once you run the script, you should be ready to start your backup via the Google Drive desktop app. If you run backups regularly, you can even schedule it in Google Apps Script by creating a time-based Trigger (see the clock icon in the left sidebar of the web app).
Some caveats
Once again, Google App Scripts have a timeout, so you may need to re-run the script multiple times. Testing for the existence of a backup is intended to mitigate this issue–if you timeout, just re-run the script and it should pick up where it left off.
I’ve also ran across some permissions errors exporting some old shared maps that I can’t work out. It seems pretty minimal, so I just ignore it, but your mileage may vary.
