Skip to content
Snapshots & recovery

Snapshots & recovery

A snapshot is one archive containing every instance’s data and oddk’s own configuration. It is what a host migration or a disaster recovery restores from.

oddk snapshot make                      # capture everything, now
oddk snapshot setup-cron --utc-hour 3   # every night at 03:00 UTC
oddk snapshot list                      # what exists, and where the copies are

Physical by default

Running instances are captured with pg_basebackup over the replication protocol — fast, no locks, no long transaction. Stopped instances are captured as a cold file copy of the data directory, which is a real, restorable capture.

Physical restores are byte-for-byte, so per-database GUCs, database-level ACLs and ICU collations all survive.

Use --logical for a portable pg_dump-based archive when you need to cross CPU architectures, or when unlogged tables must survive the restore.

Restore one instance

The rest of the deployment stays up.

oddk snapshot restore-instance --instance app --id 7

Rebuild a whole host

This runs locally against the data directory rather than through the daemon — deliberately, so it works when the daemon cannot start.

systemctl stop oddk
sudo -u oddk oddk snapshot apply \
      --file /mnt/restore/snapshot-db01-20260827.tar.zst \
      --master-key /mnt/restore/master.key
systemctl start oddk
master.key is not inside the snapshot and must be backed up separately, or the archive cannot be applied. Without it, oddk could not recover the postgres password for any restored instance.

Apply pauses every restored schedule, because the archive carries the source host’s offsite settings — an unpaused restore would upload into that bucket and run retention against it. Resume deliberately, once this host owns its bucket:

oddk snapshot setup-cron --resume

Every archive is verified

Archives are fsynced, read back, and structurally asserted before being catalogued — and verified again on download, before anything is allowed to depend on them. A corrupt archive is refused rather than silently restored.