This is the multi-page printable view of this section.
Backup & Restore
pigeon backup writes a gzip-compressed tar archive with everything needed to
restore an instance. It is a CLI-only command — no server or API is involved;
like pigeon digest, it opens the data directory directly.
What’s inside
| File | Contents |
|---|---|
pigeon.db |
Consistent SQLite snapshot: accounts, cached mail, attachments, settings and tokens |
secret.key |
The AES-256-GCM key that decrypts account passwords |
manifest.json |
Archive format version, app version, creation time and a SHA-256 checksum per file |
Run logs under <data-dir>/logs are not included.
The snapshot uses SQLite’s VACUUM INTO, so the server can keep running during
the backup. Prefer quiet periods for large mailboxes — a long snapshot delays
WAL checkpoints.
Flags
| Flag | Default | Description |
|---|---|---|
-o |
./pigeon-backup-<timestamp>.tar.gz |
Output file; must not exist |
--data |
~/.pigeon |
Data directory |
The command refuses to run when pigeon.db or secret.key is missing: creating
a fresh key for an existing database would produce an archive whose passwords
can never be decrypted again. The output file is created with 0600
permissions, an existing file is never overwritten, and a failed run removes
its partial output.
Security
The archive contains the key that decrypts your mail passwords — treat it
like a password. Encrypt it (for example with age or gpg) before storing
it off-site, and check the checksums in manifest.json after moving it:
Restoring a backup
Use pigeon restore to unpack a backup back into a data directory:
It verifies every file against the SHA-256 checksums in manifest.json,
checks that secret.key is 32 bytes and that the database passes SQLite’s
integrity_check, and only then installs the files. The target directory must
not already contain pigeon.db, secret.key or leftover -wal/-shm files —
the command refuses rather than overwrite. A missing data directory is created
with 0700.
A typical restore over an existing instance:
-
Stop the running server (
pigeon serve/pigeon mcp). -
Move or delete the old state files:
-
Restore and start again:
The archive keeps each file’s 0600 mode; run the restore as the same user
that runs Pigeon. If you prefer, the archive is a plain tar.gz and can still
be unpacked by hand.