CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Physical Backups with pg_basebackup

A physical copy of the entire cluster taken over the replication protocol while it runs - every database, every role, ready to start as a server. It is also the first half of both point-in-time recovery and a streaming replica.

Backup and Restore Guide 24 of 47 Intermediate

Written against the versions above. `-Xs` streams WAL during the backup on a second connection, which is why the result is self-consistent without needing archived WAL to start. It requires a spare `max_wal_senders` slot.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

Before you start

  1. Take a physical backup of the running cluster

  2. Look at what it produced

Official sources