ProjectsCase study 05

A backup that has been restored

My household paperwork lives in a self-hosted document system, and it existed in exactly one place. I built an encrypted off-site backup to Google Drive, then rebuilt the whole system from that backup on another machine to check that every document came back intact.

Result
58 of 58
documents matched by checksum after a full restore
Schedule
Daily and weekly, with a health check on both
When
November 2026. Next drill due by February 2027
Stack
Paperless-ngx, rclone, Google Drive, 7-Zip encryption, Bash, systemd, Docker

The problem

Scanned bills, contracts, tax records and identity documents all sat on one NAS and nowhere else. A single hardware failure or a house fire would have taken every copy.

What I built

  1. SourceDocument systemRead through a view-only account
  2. Backup hostBackup scriptDaily and weekly timers
  3. EncryptSensitive items and the full exportPassword held only in a password manager
  4. DestinationGoogle DriveNarrow, app-only access

The backup produces three things, each for a different need:

WhatFormFor
Everyday documentsReadable PDFs, filed by folderFinding one document from a phone
Identity documentsOne encrypted archiveKeeping the most sensitive items unreadable in the cloud
Full system exportEncrypted, weekly, last 8 keptRebuilding the whole system

Design decisions

1. The backup reads through a view-only account

The script signs in as a dedicated user that can view documents and change nothing. Access is granted through a group, so a future read-only integration joins the group instead of collecting its own one-off permissions.

2. A missing permission stops the run

A view-only account has a quiet failure mode: a new document it can't see is simply absent from the backup. The script checks for that and fails the run, and an automatic rule grants the group access to every new document. An incomplete backup is reported as a failure, not delivered as a success.

3. The cloud connection is as narrow as it can be

The upload uses my own Google sign-in client with a scope limited to the files the backup itself creates. It can't read anything else in the Drive account.

4. Silence is treated as failure

Each successful run leaves a time stamp. A daily health check alerts if the daily stamp is older than 36 hours or the weekly one older than 200 hours, which catches a job that has stopped running without ever reporting an error.

The restore drill

  1. I started a clean, throwaway copy of the document system on a different machine.
  2. I decrypted the latest weekly export and imported it into the clean copy.
  3. I compared every document against the live system, by the checksum of the original file and by its extracted text.

All 58 documents matched exactly. The counts of tags, correspondents, document types and folders matched too. The throwaway copy was removed afterwards, and the drill repeats quarterly.

A test that couldn't fail

While building this I found that the archive tool's “test with password” command quietly accepted an empty password and reported success. The first version of my archive check would have passed no matter what. I rewrote it to supply the password a different way, so the check can fail when it should.

What I would do next

  • Keep to the quarterly drill. One passed restore proves the process worked once.