skip to content

Backup Managers

PostgreSQL backup managers wrap base backups and WAL archiving with retention, verification and parallel restore. Interviewers compare pgBackRest, Barman and WAL-G and ask how restores get tested.

on this pageshow

explore

questions

18

In Barman, how do backup_method = rsync and backup_method = postgres differ, and how would you choose between them for a server?

level: middleimportance: must knowfreq 52%

answer

  1. low-level API versus pg_basebackup
  2. SSH versus a replication connection
  3. hard links versus WAL summaries
  4. parallel_jobs on one side only
  5. which one is still the default

basics

~20 s

backup_method = rsync, still the default, starts a backup through PostgreSQL's low-level API and copies files with rsync over SSH, offering parallel_jobs and hard-link incrementals. backup_method = postgres runs pg_basebackup over a replication connection, needs no SSH, and supports PostgreSQL 17+ block-level incrementals.

solid answer

~40 s

With `rsync`, still Barman's default, Barman starts a non-exclusive backup through the low-level API over `conninfo` and copies `PGDATA` and tablespaces with rsync over `ssh_command`. That buys `parallel_jobs`, per-tablespace bandwidth limits and `reuse_backup = link`, a file-level incremental where unchanged files are hard links and every backup stays self-contained. With `postgres`, Barman runs `pg_basebackup` over `streaming_conninfo`: paired with `streaming_archiver` it needs no SSH at all, it offers `backup_compression`, and `barman backup --incremental` gives block-level incrementals on PostgreSQL 17 or later with `summarize_wal = on`, at the price of a backup chain. The docs recommend `postgres` for most servers; choose `rsync` when parallel copy and independent backups matter on a very large cluster. Either way, keep one method per Barman server and create a new server section to switch.

code

ini · 15 lines
ini
[telemetry-pg]
backup_method = rsync
ssh_command = ssh postgres@telemetry-db
conninfo = host=telemetry-db user=barman dbname=postgres
reuse_backup = link
parallel_jobs = 4
archiver = on

[ticketing-pg]
backup_method = postgres
conninfo = host=ticketing-db user=barman dbname=postgres
streaming_conninfo = host=ticketing-db user=streaming_barman dbname=postgres
streaming_archiver = on
slot_name = barman_ticketing
create_slot = auto

go deeper

for a junior

Remember the two values, which tool each uses to copy files, and that rsync is still the default.

for a middle

Explain the transport, the incremental model and the extra options of each method, including what summarize_wal and reuse_backup do.

for a senior

Argue a choice per server from size, backup window, network rules and how a backup chain changes deletion and retention.

for a principal

Weigh standardising one method across an estate against per-server tuning, including the cost of migrating servers between methods.

## Two ways to copy a cluster Barman's `backup_method` option decides how a **base backup** (a full physical copy of the data directory) gets from the PostgreSQL host to the Barman host. The two remote methods are `rsync` and `postgres`; `local-rsync`, `snapshot` and, since Barman 3.18, `local-to-cloud` cover special cases. **`rsync` is still the default** when the option is not set, even though the documentation calls the streaming method the usual recommendation. Answers here assume Barman 3.20 protecting PostgreSQL 18. ## `backup_method = rsync` 1. Barman connects with `conninfo` and starts a **concurrent** (non-exclusive) backup through PostgreSQL's low-level API, `pg_backup_start()` on PostgreSQL 15 and later. 2. It copies `PGDATA` and every tablespace with rsync, over the SSH connection in `ssh_command` (the `barman` user logging in as `postgres`). 3. It stops the backup, forces a WAL switch so the last needed segment is archived, and runs integrity checks. What it offers: - **`parallel_jobs`**: several rsync workers copy at once (rsync method only). - **`tablespace_bandwidth_limit`**: throttling per tablespace (rsync method only). - **`reuse_backup = link`**: a **file-level incremental**. Barman hard-links every file unchanged since the previous backup and copies only changed files, so disk and time shrink while each backup remains complete on its own. Deleting an old backup never breaks a newer one; shared files stay until the last backup using them goes. WAL still has to reach Barman separately, usually through `archive_command` with `barman-wal-archive`, which is why classic rsync setups need SSH in both directions. ## `backup_method = postgres` Barman runs `pg_basebackup` over `streaming_conninfo`, a replication-protocol connection (a `replication` line in `pg_hba.conf`, a role with `REPLICATION`). `pg_basebackup` must be installed on the Barman host, ideally the newest version since it is backward compatible; `path_prefix` can point at a specific PostgreSQL `bin` directory. Paired with `streaming_archiver = on` this is the **streaming-only** setup: no SSH for backups or WAL. What it offers: - **`backup_compression`** (`gzip`, `lz4`, `zstd`; the last two need PostgreSQL 15 or later), postgres method only. - **Block-level incrementals** since Barman 3.11: `barman backup --incremental latest-full ticketing-pg` uses PostgreSQL 17's incremental `pg_basebackup`. The server must run 17 or later with `summarize_wal = on` **before** the first full backup, and the parent must itself be a `postgres`-method backup. At restore time Barman rebuilds a full copy with `pg_combinebackup` (`combine_mode` picks copy, link, clone or copy-file-range). - Streaming straight to S3-compatible storage by pointing `basebackups_directory` and `wals_directory` at a cloud URL (documented as experimental). The cost of block-level incrementals is a **chain**: an incremental is useless without its parent, so deleting a parent deletes the whole tree, retention judges the chain by its root, and `barman keep` refuses incrementals. ## Side by side | | `rsync` | `postgres` | |---|---|---| | Copy tool | rsync over SSH | `pg_basebackup` over the replication protocol | | PostgreSQL side | low-level backup API via `conninfo` | replication connection via `streaming_conninfo` | | SSH | required | none, if WAL also streams | | Parallel copy | `parallel_jobs` | one `pg_basebackup` stream | | Incremental | file-level, `reuse_backup = link` | block-level, `--incremental`, PostgreSQL 17+ | | Backup independence | every backup self-contained | incrementals depend on their chain | | Compression | no `backup_compression` | `backup_compression` | ## Choosing - **Default to `postgres` plus `streaming_archiver`** for most servers: no SSH keys to manage, convenient in containers and tightly regulated networks, and block-level deduplication on 17 and later. - **Choose `rsync`** for a very large cluster where parallel copy and per-tablespace throttling cut the backup window, or where you want every backup independent of the others, for example a telemetry database with large, mostly read-only history. - A **hybrid** is allowed: `backup_method = rsync` with `streaming_archiver = on` keeps rsync's features and streams WAL. - **Network rules matter.** `rsync` needs SSH from the Barman host to the database host, and back again if WAL ships through `archive_command`; `postgres` needs only a PostgreSQL replication connection, which is often the easier firewall rule to get approved. - **Restores differ too.** An rsync backup is copied back as plain files, while a block-level incremental is first combined with `pg_combinebackup` into a synthetic full backup, which costs staging disk and time during the restore. - **One method per server.** The docs advise against switching methods in place; add a new server section with the new method, take a full backup there, and retire the old section when its backups expire.

  • What happens in Barman if you delete the full backup that a chain of block-level incrementals depends on?
    `barman delete` warns that the backup has dependent incrementals and deletes the whole tree, because an incremental cannot be restored without its root. Retention likewise judges a chain by its root backup. With rsync and `reuse_backup = link` there is no such dependency: hard-linked files survive until the last backup that uses them is removed.
  • What must be installed on the Barman host for backup_method = postgres?
    The PostgreSQL client binaries Barman calls: `pg_basebackup` for backups and `pg_receivewal` if WAL streams. Use the newest version, since it is backward compatible with older servers, and set `path_prefix` to a specific `bin` directory if several are installed. `barman check` reports `pg_basebackup compatible` when the version is wrong.

  • backup_method = postgres is what Barman uses when nothing is set
  • Barman's rsync method copies a live data directory without telling PostgreSQL
  • reuse_backup = link gives incrementals with backup_method = postgres
  • Barman block-level incrementals work on PostgreSQL 16
  • parallel_jobs speeds up pg_basebackup-based Barman backups

Assumes Barman 3.20 backing up PostgreSQL 18; block-level incrementals need Barman 3.11+ and PostgreSQL 17+, and rsync remains Barman's default backup_method.

open as a page

With pgBackRest, how do full, diff and incr backups depend on each other, and how do repo1-retention-full and repo1-retention-diff decide what expire removes?

level: middleimportance: must knowfreq 58%

basics

~20 s

A pgBackRest full stands alone, a diff holds files changed since the last full, and an incr holds files changed since the last backup of any type. Expire removes the oldest fulls beyond repo1-retention-full, along with their diffs and incrs.

open as a page

With WAL-G on PostgreSQL, what do backup-push and wal-push each upload, how is each triggered, and why do you need both?

level: middleimportance: must knowfreq 55%

basics

~20 s

backup-push uploads a base backup of the data directory on a schedule; wal-push uploads each finished WAL segment, called by archive_command. A base backup is only consistent with the WAL written during it, and PITR needs the WAL after it.

open as a page

Using WAL-G, how do you restore a containerised PostgreSQL 18 from object storage with backup-fetch LATEST and wal-fetch, and what can silently go wrong?

level: middleimportance: must knowfreq 50%

basics

~10 s

Run wal-g backup-fetch into an empty data directory with LATEST, create recovery.signal, set restore_command = 'wal-g wal-fetch %f %p' and start PostgreSQL. A storage error from wal-fetch can end recovery early, so wrap it.

open as a page

With Barman, how do you restore the timetable server onto a new host to 09:39, just before a bad import ran at 09:40, and what does barman restore set up?

level: seniorimportance: must knowfreq 48%

basics

~20 s

Run barman restore with --remote-ssh-command to the new host, a backup that ended before 09:39 (or auto), --target-time with an explicit zone and usually --get-wal. Barman copies the files, writes restore_command and the target, creates recovery.signal and disables archive_command; you start PostgreSQL.

open as a page

With pgBackRest, how does restore --delta shorten rebuilding a PostgreSQL data directory that already holds most of its files, and when should you use it?

level: seniorimportance: must knowfreq 46%

basics

~20 s

pgBackRest restore --delta keeps existing files whose SHA-1 matches the backup manifest, restores only mismatched or missing files, and deletes files the backup lacks. Rebuilding a mostly intact data directory then copies a fraction of the data.

open as a page

What is Barman in a PostgreSQL backup setup, and what does running barman check against a newly configured server tell you?

level: juniorimportance: should knowfreq 45%

basics

~20 s

Barman is a backup manager whose one host keeps physical base backups and archived WAL for many PostgreSQL servers. barman check SERVER tests a server's connections, WAL shipping, directories and settings, printing OK or FAILED per line and exiting non-zero on failure.

open as a page

With pgBackRest, what is a stanza, and what steps take a new PostgreSQL cluster to its first backup with WAL archiving proven to work?

level: juniorimportance: should knowfreq 42%

basics

~20 s

A stanza is pgBackRest's named configuration for one PostgreSQL cluster: its data path, repositories and options. Set archive_command to pgbackrest archive-push, run stanza-create, prove archiving with check, then take the first backup, which is automatically a full.

open as a page

With WAL-G backing up a containerised PostgreSQL, how do you point it at an S3 bucket and choose compression and encryption?

level: juniorimportance: should knowfreq 32%

basics

~10 s

Set WALG_S3_PREFIX (s3://bucket/path) and AWS credentials, choose WALG_COMPRESSION_METHOD (lz4 by default; zstd, lzma, brotli or none) and encrypt client-side with WALG_LIBSODIUM_KEY or a PGP key, all where the PostgreSQL server process can read them.

open as a page

In Barman, how do retention_policy = REDUNDANCY 3 and RECOVERY WINDOW OF 7 DAYS differ, and what actually enforces them?

level: middleimportance: should knowfreq 38%

basics

~20 s

REDUNDANCY 3 keeps the three newest full backups. RECOVERY WINDOW OF 7 DAYS keeps the backups and WAL needed to recover to any moment of the last seven days, including the newest backup before the window. barman cron enforces both; unset means nothing is deleted.

open as a page

With pgBackRest, what do the check and verify commands each prove about a stanza, and when would you run each?

level: middleimportance: should knowfreq 34%

basics

~20 s

pgBackRest check proves the live path works: it forces a WAL switch and waits for that segment to reach the repositories. verify proves stored data is intact: it rereads backups and archived WAL and compares sizes and checksums with the manifests.

open as a page

In WAL-G for PostgreSQL, what does wal-g delete retain FULL 7 --confirm keep and delete, and when can delete retain remove the wrong backups?

level: middleimportance: should knowfreq 42%

basics

~20 s

It keeps the seven newest full backups with their deltas and deletes older backups plus the WAL before the oldest one kept. Without --confirm it is a dry run; after pg_upgrade name-based ordering can delete the new backups.

open as a page

In Barman, what is the difference between collecting WAL with archiver = on and with streaming_archiver = on, and when would you enable both?

level: seniorimportance: should knowfreq 40%

basics

~20 s

archiver = on takes completed WAL segments pushed by archive_command, ideally barman-wal-archive, into the incoming directory. streaming_archiver = on runs pg_receivewal through a replication slot, receiving WAL as it is written for a lower RPO. Enabling both adds a fallback; Barman stores each segment once.

open as a page

Using Barman's barman-cloud-* scripts without a Barman server, how do you back up a PostgreSQL server to object storage, and what do you give up?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Install barman-cli-cloud on the PostgreSQL host, set archive_command to barman-cloud-wal-archive, and schedule barman-cloud-backup plus barman-cloud-backup-delete -r for retention. You give up the Barman server: no cron, no barman check, no incrementals, and barman-cloud-restore leaves recovery configuration to you.

open as a page

With pgBackRest backing up a 5 TB PostgreSQL cluster to an object-store repository, which options shorten backups and keep WAL archiving ahead, and what does each cost?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Raise process-max, switch compress-type to zst, enable repo-bundle and then repo-block, turn on archive-async with a spool path, and back up from a standby. Each one costs CPU, compatibility with older pgBackRest, or extra configuration.

open as a page

With WAL-G delta backups on PostgreSQL, what does WALG_DELTA_MAX_STEPS control, and what does a longer delta chain cost you at restore time?

level: seniorimportance: should knowfreq 30%

basics

~20 s

WALG_DELTA_MAX_STEPS (default 0, disabled) is how many delta backups may follow a full before backup-push takes a full again. Longer chains upload less but make restores fetch and apply every link, and one missing link breaks them.

open as a page

What does wal-g wal-verify check on a PostgreSQL WAL archive, and how do you act on an integrity FAILURE or a timeline FAILURE?

level: seniorimportance: should knowfreq 26%

basics

~20 s

wal-g wal-verify integrity checks that every WAL segment from the oldest backup's start to the current segment is in storage; timeline checks that no higher timeline exists there. An integrity FAILURE needs a fresh backup; a timeline FAILURE means another cluster writes there.

open as a page

With pgBackRest protecting a 5 TB SaaS analytics PostgreSQL cluster, how would you design two repositories, one in object storage, to meet its RPO and RTO?

level: principalimportance: should knowfreq 27%

basics

~20 s

Make repo1 a nearby repository for fast restores with short retention, and repo2 an encrypted object-store repository for off-site, longer retention. archive-push feeds both, ideally asynchronously; schedule backups, retention and verify per repository; restore from the nearest one.

open as a page