Recovery & disaster runbooks
Recovery in squirrel is deliberately a set of explicit, human-driven acts — never something the agent does on a cadence. Each one preserves the audit trail: the runs table is never pruned, and no history is overwritten without an opt-in operator command. This page collects the recovery paths.
Resetting a wrecked destination
Section titled “Resetting a wrecked destination”squirrel destination reset <name> forgets everything the index records about
a destination’s remote state — its per-content, per-pack and per-mirror-path
upload ledgers, its live durability vector, and its push-freshness maxima — so
the next sync treats the destination as fresh and re-uploads.
Use it when a destination’s recorded state no longer matches reality and a sync
refuses to proceed. The classic case: after wiping a remote, or pointing an
existing destination name at a fresh root, the layout guard refuses — its
recorded history under that destination name expects a
content-addressed manifest segment, a
packed placement map, or a native
mirror’s receipt that is no longer there. An emptied root is refused too while its upload records remain:
a push would otherwise skip everything those records claim is still there.
Before this verb, the only escape was hand-editing SQLite or
renaming the destination across every machine’s config.
squirrel destination reset s3archive --dry-run # preview what would clearsquirrel destination reset s3archive --yes # actually clear itIt is a change command, so it is weighty by design: it prints what it will
clear, and refuses without --yes (or a --dry-run preview).
What is and isn’t cleared
Section titled “What is and isn’t cleared”Cleared (derived state only):
remote_objects,remote_packsandremote_paths— the upload ledgers.- the destination’s durability vector and push-freshness rows.
Preserved (the audit trail):
- the runs table — every past sync, verify, and audit stays; the reset is itself recorded as a new audit run.
- the append-only durability advance log — the record of what was ever asserted durable survives, exactly as revoking a peer leaves its history intact.
- the content and files rows — squirrel never loses track of content.
The remote bytes are not touched — reset only clears squirrel’s record. If you want the destination genuinely empty, wipe or repoint the remote root separately. Once the configured root is empty on the remote, the layout guard recognises the fresh start on its own and the next sync re-uploads from scratch.
Rebuilding a machine from its hub
Section titled “Rebuilding a machine from its hub”When an edge machine dies (the most likely disaster), rebuild it from
the hub with a reverse peer push — the same peer-sync mechanism the hub uses
to feed a receive-only node every day. There is no separate restore verb for
this: squirrel restore pulls from destinations, not from peer nodes,
and the machinery to push a volume to a node already exists.
The story, using the reference setup
(rebuilding laptop from nas):
-
Install and re-pair the replacement. Install squirrel, generate its agent cert, and re-establish the peer relationship with the hub. Use the pairing helper so the token matrix is correct by construction:
Terminal window squirrel agent cert # on the replacement: new cert + pinsquirrel node pair nas # emits matching config halves for bothPaste each half into the named machine’s config and fill any placeholders (see Peer sync). The replacement runs an agent that listens so the hub can dial it — the reverse of its normal initiate-only role.
-
Point the hub at the replacement, temporarily. On the hub, add the replacement as a
[nodes.laptop]entry and list it in thesync_toof the volumes to restore. Then drive the push:Terminal window squirrel sync photos --to laptopsquirrel sync docs --to laptopThe hub enumerates its master copy and pushes; the replacement receives and re-hashes every path (
peer-blake3), so the restore is content-verified end to end. Both sides record correlated runs — the recovery is in the audit trail like any other sync. -
Return to steady state. Once the replacement holds the volumes, remove the temporary hub-side
sync_to/[nodes.laptop]push config, and resume the normal edge → hub direction (laptopinitiating tonas).
When the hub dies: squirrel recover
Section titled “When the hub dies: squirrel recover”The mechanisms below all work on their own, but assembling them in the right order is the hard part — and a wrong order is expensive. Restoring volumes before the catalog means restoring with nothing to verify against; re-pairing peers before the index is back means a peer syncing into an empty node.
squirrel recover sequences them.
Point it at a destination that carried this machine’s syncs:
squirrel recover --from cloudboxThat touches nothing. It lists the index snapshots the destination holds and how old each is, then prints the whole plan — which snapshot it would install, which volumes it would restore, which peers need re-pairing — and stops. Run it as often as you like while deciding.
When the plan is right:
squirrel recover --from cloudbox --executeEach phase asks before it acts:
- Install the index. Fetches the snapshot (the newest unless you pass
--snapshot) and makes it the live index. Any existing index is preserved beside it, never deleted. The recovery is recorded as anauditrun in the recovered database — the one it replaced has stopped being the trail anyone reads, so that is the only place the record survives. - Restore the volumes. A normal
restoreper volume, verified against the index from phase 1, each with its own run row. - Re-pair the peers. Squirrel prints the
agent certandnode paircommands for each peer. Pairing writes to both machines and needs the peer reachable and consenting, so this side names the commands rather than running them.
A step that cannot proceed stops the sequence and says why, rather than half-recovering. Re-running picks up from the volume that failed.
Two things it deliberately will not do. It refuses a peer node as --from:
recovering a dead edge machine is a reverse peer push from the surviving hub
(above), not a recover run. And it never runs unattended — --yes exists for a
rehearsed recovery, but a non-interactive stdin without it stops rather than
assuming consent.
The mechanisms underneath
Section titled “The mechanisms underneath”recover drives these. They remain first-class on their own, and are the right
answer when you want one piece rather than the sequence — or when the
destination carries bytes but no catalog to recover the index from.
Mirror restore
Section titled “Mirror restore”For a mirror destination (including an encrypted
one), squirrel restore pulls the volume back
byte-for-byte. A native mirror checks every file against the index’s BLAKE3, or
against its receipts without an index; an rclone mirror decrypts on the way down
and compares checksums where the backend exposes them.
Recovering the index too
Section titled “Recovering the index too”squirrel rides an index snapshot
along to its destinations under .squirrel-index/. When the hub itself dies,
a restore from a destination yields the data and the index that explains it — fetch
the ride-along snapshot and swap it in as the live index with
squirrel db restore. runs and query
answer immediately against the recovered catalog.
Packed & content-addressed recovery
Section titled “Packed & content-addressed recovery”The content-addressed and packed formats are deliberately simple enough to recover without squirrel — the manifest and pack formats are documented, so the bytes are recoverable with standard tools even if squirrel is unavailable.