Few Servers

Keyword BACKUP · from our Short

Back up Postgres on a small server: dump first, then restic

On 9 Oct 2026 restic backed up two Postgres dumps and 6 Docker volumes (174.8 MiB) on our 1 GB test server in 27 seconds and stored 23 MiB. The one mistake to avoid: treating a copy of the live Postgres data folder as your database backup.

The checklist

  1. Dump the database first. docker exec <postgres-container> pg_dumpall -U <user> | gzip > /var/backups/pg/db.sql.gz. PostgreSQL's own documentation says a file-level copy of a running server is not reliably usable; the dump is.
  2. Back up the dump and the volumes with restic. restic backup /var/backups/pg /var/lib/docker/volumes/<volume>/_data. Keep the volumes for files that are not databases, such as n8n's encryption key.
  3. Put the repository off the server. A repository on the same disk protects against mistakes, not against losing the server. Use an S3-compatible bucket (RESTIC_REPOSITORY=s3:https://<endpoint>/<bucket>/<folder>).
  4. Copy the password file somewhere else now. Without it nobody can read the backups, including you.
  5. Run it at night, niced. On one vCPU our first backup left 0% idle CPU in 25 of 26 seconds. Nice=10 and idle I/O priority in the systemd unit let your apps go first.
  6. Check it. restic check, and alert when the last snapshot is more than a day old.
  7. Restore it once. The drill is on the next page: RESTORE.

The full test

The starter kit does all of this with one script (60-backup.sh): dumps, restic, a nightly niced timer, check and restore commands. Pay what you want.