Skip to content

pgBackRest commands

Run these Make targets from the komp.ac server directory. Each target invokes the configured pgBackRest binary with the selected config and stanza.

Command Safety level Underlying action Purpose
make backup-info Low risk info Reads and displays repository metadata
make backup-check Operational check Checks stanza and archive/repository communication
make backup-stanza-create Configuration-changing stanza-create Registers the configured cluster in the repository
make backup-full Production-impacting --type=full backup Creates a new full recovery base
make backup-diff Production-impacting --type=diff backup Backs up changes since the current full backup
make backup-incr Production-impacting --type=incr backup Backs up changes since the previous backup
make backup Production-impacting Same as backup-incr Convenience alias for the normal incremental run

backup-info does not change PostgreSQL or repository contents. backup-check is an operational health command rather than a purely passive report: run it against the intended stanza and expect it to exercise archive communication.

Backup commands are safe for an online PostgreSQL cluster when pgBackRest is configured correctly, but they are not zero-impact. They consume database, disk, network, and repository I/O. Completing a new backup can also make older backup or WAL data eligible for expiration under the configured retention policy.

The command exits when pgBackRest exits and returns its success or failure to Make. These targets do not create application operation IDs and cannot be polled through the server.

Terminal window
make backup-stanza-create

This creates stanza metadata in the repository for the PostgreSQL cluster described by the configuration. Run it once when setting up a new stanza or a new repository.

It does not:

  • create a backup;
  • enable PostgreSQL WAL archiving;
  • create the PostgreSQL cluster;
  • verify that a future restore works.

If the stanza already exists, investigate the pgBackRest response rather than recreating or overwriting repository metadata casually. The stanza name and pg1-path must refer to the intended cluster.

There is no corresponding stanza-create operation in the komp.ac server API.

Terminal window
make backup-full

A full backup reads the entire configured PostgreSQL cluster and creates a new base for later differential and incremental backups. Create a full backup first, before relying on the shorter backup types.

Full backups usually consume the most time, I/O, and repository space. They reduce dependence on older chains and establish the unit controlled by full-backup retention.

Schedule the first full backup and unusually large full backups with database load in mind. Monitor PostgreSQL latency, storage space, repository capacity, and WAL archiving while the command runs.

The example repository config retains two full backups. Retention is a repository policy, not a property of this command; the actual configuration in production is authoritative.

Terminal window
make backup-diff

A differential backup stores files changed since the associated full backup. Restoring it requires that full backup but does not depend on intervening incremental backups.

Differentials are typically larger than incrementals taken at the same point, but they shorten the dependency chain. Use them as scheduled intermediate recovery anchors when that trade-off matches the recovery plan.

The example config retains seven differential backups. As with full retention, verify the deployed repository configuration rather than assuming the example policy is active.

Terminal window
make backup-incr

An incremental backup stores files changed since the immediately preceding backup, whether that predecessor was full, differential, or incremental. It is normally the smallest and fastest backup type, but restoration depends on the chain pgBackRest records in the repository.

An incremental backup does not mean “only SQL inserts.” It captures changed PostgreSQL files, including the effects of updates, deletes, indexes, sequences, and other database storage changes.

Terminal window
make backup

This is only a Make alias for backup-incr. It does not choose a backup type dynamically and does not fall back to differential based on age or repository size.

Use this alias for the routine schedule only after the stanza, full backup, WAL archiving, monitoring, and retention policy are established.

The alias does not schedule periodic full backups. Your external schedule must still create new full backups according to the recovery and retention policy; an endless sequence of incrementals tied to an aging full backup is not a complete operating plan.

Terminal window
make backup-check

This runs pgBackRest’s check command for the selected stanza. Use it after initial configuration, after changing archive settings or credentials, and as a scheduled health signal.

The check exercises stanza configuration and verifies that PostgreSQL archiving and the repository can communicate correctly. A successful check is necessary but not sufficient recovery proof. It does not restore the cluster, start PostgreSQL from restored files, replay the full required WAL range, or validate komp.ac data.

Terminal window
make backup-info

This runs pgBackRest info and prints its human-readable output. Consult it before every recovery decision.

Important fields include:

  • stanza and database status;
  • backup labels and full/differential/incremental type;
  • backup start and stop timestamps;
  • database and repository sizes;
  • backup-chain relationships;
  • WAL start and stop positions;
  • errors or missing repository state.

The Make target does not parse or validate the output for you. Preserve the output with the incident record and compare it with the intended target.

Of all provided commands, this is the correct first command when an operator needs to inspect backup state without starting work.

Every command accepts Make variable overrides:

Terminal window
make backup-check \
PGBACKREST=/opt/pgbackrest/bin/pgbackrest \
PGBACKREST_CONFIG=/srv/komp-ac/pgbackrest.conf \
PGBACKREST_STANZA=komp_ac_production

These variables affect this Make invocation only. They do not reconfigure the running komp.ac server and do not change PostgreSQL’s archive_command.

Always compare the effective stanza, config path, repository, and PostgreSQL data path before creating or checking backups. A correct command pointed at the wrong stanza can create misleading backup evidence or consume space in the wrong repository.

The current Makefile provides neither a dump target nor a restore target. Logical dumps are available only through the Rust server, as described in pg_dump logical dumps. Read pgBackRest safety before production use, then see pgBackRest server operations for the authenticated physical-backup alternative.