How I Back Up sketches this backup; here’s the recipe. You need a TrueNAS and a Google account.
The Takeout export
- Start a Google Takeout and pick your products.
- On the delivery screen, set delivery to Add to Drive and file type to
.tgz—tarunpacks.tgzdirectly, where a.zipneeds another step. - Start the export, optionally scheduling six a year. It lands in a
Takeoutfolder in Drive as numbered tarballs.
The Cloud Sync task
The Cloud Sync Tasks reference lists every field; these are the ones this recipe sets, in the current SCALE menus:
- Under Credentials → Backup Credentials, add a Cloud Credential for Google Drive and log in to authorise it.
- Under Data Protection → Cloud Sync Tasks, click Add.
- Set Direction to PULL and Transfer Mode to SYNC.
- Set Credential to the one from step 1.
- Set Folder to the Drive path Takeout lands in—mine is
/Takeout. - Set Directory/Files to a
tarballs/directory in the dataset you want the copy to live in. - Set a Schedule; mine runs daily at 02:00.
- Turn on Acknowledge Abuse, or Drive blocks the large machine-generated archives and the pull fails.
- Turn on Fast List—fewer listing calls against Drive, at some memory.
- Under Advanced Options, set Post-Script to
extract.sh, below. - Save, then Run Now once to confirm the pull and the extract land where you expect.
- Once a generation extracts cleanly, delete the export from Drive. The next sync clears the local tarball; the extracted copy sits in a sibling directory the sync never touches, so it stays.
The post-script
Point step 10’s Post-Script at extract.sh, passing your dataset path and
keep window as its two arguments:
#!/usr/bin/env bash
set -euo pipefail
shopt -s nullglob
# Dataset holding the pulled tarballs/ and the extracted generations.
# Pass it as the first argument, or edit this default.
TAKEOUT_DIR="${1:-/mnt/pool/takeout}"
# Keep generations newer than this many days; prune the rest.
KEEP_DAYS="${2:-180}"
extract_generation() {
local tarball="$1"
# takeout-20260728T090000Z-001.tgz -> generation "20260728T090000Z"
local generation
generation="$(basename "$tarball")"
generation="${generation#*-}"
generation="${generation%%-*}"
mkdir -p "${TAKEOUT_DIR}/${generation}"
tar -xf "$tarball" -C "${TAKEOUT_DIR}/${generation}"
}
for tarball in "${TAKEOUT_DIR}"/tarballs/*.tgz; do
extract_generation "$tarball"
done
find "$TAKEOUT_DIR" -mindepth 1 -maxdepth 1 -type d -not -name tarballs \
-mtime "+${KEEP_DAYS}" -execdir rm -rf {} +
Mine keeps 180 days—three generations at a two-month cadence, so one bad
export never costs the last good one. The exact copy I run, with a personal
tar --exclude re-added, is documented as a how-to.
Two gaps: nothing here catches a truncated download, so I check each extracted tree before deleting the Drive copy; and the prune trusts the clock, so if exports stopped it would delete down to nothing.