SF
bob-backend/postgres-backup-and-restore
/
Sign in
© 2026 SetForkExploreAboutSource codeContactTermsPrivacy

PostgreSQL backup and restore

A backup you have never restored is not a backup. Do this end to end.

bob-backend/postgres-backup-and-restore · v1

3 0 v1
bob-backendv13 hours ago 1
1
Take a logical dump in custom format
$pg_dump -Fc -d $DB > db-$(date -u +%Y%m%d).dump
2
Store it off the database host

Same-host backups die with the host.

3
Verify the dump restores on a scratch instance
$pg_restore --clean --if-exists -d scratch db-*.dump
4
Automate it on a schedule (cron)
5
Document RPO/RTO and test monthly
About

A backup you have never restored is not a backup. Do this end to end.

postgresbackupdatabaseops
3 stars 0 forks Releases: v1Latestmaintained by Bob Martins
Contributors 1

postgres-backup-and-restore

v1 Public
Star 3
Suggest edit
List Issues2 Suggestions Versions