Back up PostgreSQL on a VPS
What we'd pick
- A side projectNightly pg_dump, encrypted, off the server
- You know PostgreSQL wellpgBackRest or WAL-G, with restore tests
- You'd rather not maintain itRowsafe
- Files and apps tooA dump service, plus WAL archiving
- You don't want a serverManaged PostgreSQL
The options
ApproachData you can loseAny secondTested for youYour workCost
pg_dump + cronData you can loseUp to 24 hoursAny secondNoTested for youNoYour workScript, copies, alertsCostFree
SnapShooter, SimpleBackupsData you can loseSince the last backupAny secondNoTested for youNoYour workPick a scheduleCostFree plans; from $14/month
pgBackRest, WAL-G, BarmanData you can loseMinutes, as you set itAny secondYesTested for youNo, checks onlyYour workConfig, alerts, testsCostFree, plus your time
DatabasusData you can loseSince the last dump (less on 17+)Any secondPartial: PostgreSQL 17+Tested for youYes, on your agentYour workHost DatabasusCostFree, plus hosting
Managed PostgreSQLData you can loseMinutes, by providerAny secondYes (an add-on on Supabase)Tested for youPartial: RDS onlyYour workMove your dataCostPer instance
RowsafeData you can loseUp to about a minuteAny secondYesTested for youYes, weeklyYour workOne commandCostFree for 1 server
Sources, checked
- PostgreSQL docs: SQL dump
- PostgreSQL docs: continuous archiving and point-in-time recovery
- PostgreSQL docs: file system level backup
- pgBackRest: features and license
- WAL-G on GitHub: databases, license, encryption
- Barman: overview
- SnapShooter: PostgreSQL backups
- SnapShooter: pricing
- SimpleBackups: pg_dump cron replacement (logical backups, PITR, encryption)
- SimpleBackups: pricing
- Databasus on GitHub
- Databasus: FAQ (PITR on PostgreSQL 17+)
- Databasus: restore verification
- Amazon RDS: point-in-time recovery
- AWS Backup: restore testing
- Supabase docs: database backups and PITR
Out of date? Tell us.
What a good setup has
- Restore to any second
- Copies off the server
- Encrypted with your key
- One to two weeks back
- Restores tested on a schedule
- Alerts when backups stop
Questions
Is pg_dump enough to back up PostgreSQL on a VPS?
Only if losing the writes since the last dump is fine. For anything you can't recreate, add WAL archiving and test restores.
Are my VPS provider's snapshots a good PostgreSQL backup?
As an extra: they're usually daily and live with the same provider. PostgreSQL's docs say they're only safe when every volume is frozen at the same instant.
Is there a service that tests my PostgreSQL backups automatically?
Rowsafe restores a full copy every week and alerts you if it fails. Databasus can verify restores in a throwaway container, and AWS Backup can schedule restore tests for RDS.
How do I protect my database from AI coding agents?
Keep point-in-time recovery on and save a named restore point before every risky change. Rowsafe's Guard does it through an MCP server and a Claude Code hook.