Skip to content

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.

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.

Terminal window
squirrel destination reset s3archive --dry-run # preview what would clear
squirrel destination reset s3archive --yes # actually clear it

It 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).

Cleared (derived state only):

  • remote_objects, remote_packs and remote_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.

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):

  1. 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 + pin
    squirrel node pair nas # emits matching config halves for both

    Paste 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.

  2. Point the hub at the replacement, temporarily. On the hub, add the replacement as a [nodes.laptop] entry and list it in the sync_to of the volumes to restore. Then drive the push:

    Terminal window
    squirrel sync photos --to laptop
    squirrel sync docs --to laptop

    The 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.

  3. 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 (laptop initiating to nas).

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 cloudbox

That 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 --execute

Each phase asks before it acts:

  1. 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 an audit run in the recovered database — the one it replaced has stopped being the trail anyone reads, so that is the only place the record survives.
  2. Restore the volumes. A normal restore per volume, verified against the index from phase 1, each with its own run row.
  3. Re-pair the peers. Squirrel prints the agent cert and node pair commands 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.

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.

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.

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.

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.