Backups and restore

Backups and restore

A relay's data directory is the whole relay. Copy it with the relay stopped, restore it by putting it back, and you never need anyone's key to do either.

What a backup holds

PathHoldsReadable from the backup
objects/Every sealed object, by content addressCiphertext only
keyringThe content key of every Internal object it receivedYes: it opens all Internal content
grants/The grant mailbox: sealed grants, indexed by recipient public keyWho each grant is for and when it reveals, never the key inside
graph, headsThe changes and the current headsYes: paths, messages, authors, history
the other filesThe store's bookkeeping, and a role file marking it a relaySmall; back them up with the rest

So a backup is ciphertext for Restricted content and for Embargoed content: those keys never reach a relay. An Embargoed key travels only inside a grant sealed to its recipient. Internal content is a different matter. Its keys ride along to every relay, so whoever holds the backup can read it (see Relays and hosts). Protect the backup as you would the Internal files themselves.

The allowlist is not in the data directory. It lives in the command line, so back up your unit file too.

Back up

The commands below assume the service and paths from Deploy to a VPS. Each file is replaced atomically, but a push writes objects and then several files, so a copy taken mid-push may not agree with itself. Stop the relay for the copy. A push cut off by the stop is resumable: the pusher re-runs it.

systemctl stop loot-relay
tar -C /var/lib -czf /backup/loot-relay-$(date +%F).tgz loot-relay
systemctl start loot-relay

Restore

systemctl stop loot-relay
mv /var/lib/loot-relay /var/lib/loot-relay.old
tar -C /var/lib -xzf /backup/loot-relay-2026-10-05.tgz
chown -R loot:loot /var/lib/loot-relay
systemctl start loot-relay

A copied store serves from wherever you put it. Check it with loot count-objects --dir <dir>, which reads and changes nothing.

Then ask the pushers to run loot push. Anything they pushed after the backup is still on their machines, and a push sends what the relay lacks. Grants deposited after the backup and not yet collected are gone: their senders must run loot grant --relay again.

Traps

  • A burn deletes bytes from the live store. It can't reach your backup copies, which keep those bytes until you delete them.
  • Restore a store into a directory of its own. loot serve creates a fresh, empty store in a new or empty directory, so a --dir that misses the restore starts an empty relay, not an error.