4.2k stars · MIT · release/2.59.0 (2026-07-20, ungh). CORRECTED on 2026-09-23: Edition 18 recorded v2.58.0 of 2026-01-19, which was one release behind · Track this in Scout
Point-in-time backup and restore for PostgreSQL, which a file-level snapshot cannot give you.
▶Repo detailsthe review · specs · pros & cons · install
What it is
pgBackRest is a backup program written for PostgreSQL and nothing else. It takes full and partial backups, keeps a copy of every change made since the last one, checks that what it wrote can be read back, and restores to a point in time you name.
What it is good for. Anyone who runs their own database on their own server. Edition 8 recommended restic, which is an excellent tool for files, and Edition 15 recommended Healthchecks, which tells you when a job did not run. Neither of those solves the database problem, because a file-level copy of a live PostgreSQL folder can be internally inconsistent. This is the tool that closes that hole, and it is the only kind of backup that lets you undo a mistake made at 14:30 by restoring to 14:29. If everything a product knows lives in one PostgreSQL database, this is the single highest-value item in this edition.
- It can restore to any minute you choose, not only to the moment of the last backup.
- It can write backups to a second disk and to S3-style cloud storage at the same time, so one dead machine does not take the backups with it.
- It reads its own backups back and checks them, so a broken backup is found before you need it.
- Setup is a configuration file and a scheduled job, not one command. Expect two to three hours the first time.
- It works with PostgreSQL only. It will not back up your files, your images or anything else.
- A backup you have never restored is a guess. You have to rehearse a restore once, on a spare machine, or you do not know that it works.
# On the server, as root. Debian or Ubuntu: sudo apt update sudo apt install pgbackrest # Tell it where to keep backups and which database to protect. sudo mkdir -p /var/lib/pgbackrest sudo chown postgres:postgres /var/lib/pgbackrest sudo tee /etc/pgbackrest/pgbackrest.conf > /dev/null <<'EOF' [global] repo1-path=/var/lib/pgbackrest repo1-retention-full=2 start-fast=y [main] pg1-path=/var/lib/postgresql/16/main EOF # Then, in postgresql.conf, switch on change logging and point it at pgBackRest: # archive_mode = on # archive_command = 'pgbackrest --stanza=main archive-push %p' # Restart PostgreSQL, then: sudo -u postgres pgbackrest --stanza=main stanza-create sudo -u postgres pgbackrest --stanza=main check sudo -u postgres pgbackrest --stanza=main --type=full backup
