PG_BASEBACKUP(1) PostgreSQL 18.6 Documentation PG_BASEBACKUP(1) (NAME) pg_basebackup - PostgreSQL (SYNOPSIS) pg_basebackup [...] (DESCRIPTION) pg_basebackup (base backup) PostgreSQL . (point-in-time recovery 25.3 ) (standby) log-shipping streaming-replication ( 26.2 ). pg_basebackup (full) (incremental) . . . pg_combinebackup(1) . 25.3.3 25.3.5 . pg_basebackup . . pg_dump(1) . PostgreSQL (replication protocol) . (user ID) REPLICATION ( 21.2 ) (superuser) pg_hba.conf . max_wal_senders walsender WAL ( ) . pg_basebackup . pg_basebackup (primary) (standby) . standby ( max_wal_senders hot_standby pg_hba.conf ). full_page_writes primary . standby : o (backup history file) . o pg_basebackup standby WAL . -X none primary pg_basebackup WAL . pg_switch_wal primary WAL . o standby primary . o WAL full-page writes full_page_writes primary . pg_basebackup pg_stat_progress_basebackup . 27.4.6 ..SH " (OPTIONS)" : -D directory --pgdata=directory . pg_basebackup ( ) . . tar - ( dash) tar stdout . . -F format --format=format . format : p plain (plain) tablespace . tablespace . tablespace tablespace . ( --tablespace-mapping .) . t tar tar . base.tar tablespace tar OID tablespace . - ( ) tar (pipe) gzip . tablespace WAL . -i old_manifest_file --incremental=old_manifest_file (incremental backup) . . -R --write-recovery-conf standby.signal postgresql.auto.conf ( tar) . standby . postgresql.auto.conf (replication slot) pg_basebackup (streaming replication) (logical replication slot synchronization) . (dbname) . -t target --target=target . client pg_basebackup . server:/some/path /some/path . (superuser) pg_write_server_files . blackhole . . WAL pg_basebackup -Xstream . -Xfetch -Xnone . -T olddir=newdir --tablespace-mapping=olddir=newdir tablespace olddir newdir . olddir tablespace . ( tablespace olddir .) newdir . newdir . olddir newdir . (=) . tablespace . tablespace . tablespace . plain tar . --waldir=waldir WAL ( write-ahead log) . WAL pg_wal . waldir . waldir . plain . -X method --wal-method=method WAL ( write-ahead log) . . none postmaster WAL . (method) : n none . f fetch . wal_keep_size . . tar base.tar . s stream (stream) . . . ..sp tar write-ahead log pg_wal.tar ( 10 pg_xlog.tar ). . -z --gzip gzip tar . tar .gz tar . -Z level -Z [{client|server}-]method[:detail] --compress=level --compress=[{client|server}-]method[:detail] . client server . CPU . client --target . . -Xstream WAL . WAL -Xfetch . gzip lz4 zstd none ( 0 gzip 0 ) . . . keyword keyword=value . level long workers . . . 0 gzip 0 . tar gzip lz4 zstd .gz .lz4 .zst tar . plain . . -Xstream gzip pg_wal.tar gzip . : -c {fast|spread} --checkpoint={fast|spread} checkpoint fast () spread () ( 25.3.4 ). -C --create-slot replication slot --slot . replication slot . -l label --label=label . "pg_basebackup base backup" . -n --no-clean pg_basebackup ( write-ahead log). . tablespace . -N --no-sync pg_basebackup . pg_basebackup (crash) . . -P --progress . . 100% . WAL WAL . -r rate --max-rate=rate . pg_basebackup . . M . k . 32 1024 . . WAL fetch . -S slotname --slot=slotname -X stream . WAL replication slot . (standby) (streaming-replication) replication slot standby replication slot primary_slot_name . WAL streaming replication standby . replication slot -C . replication slot ( 10 ) replication slot WAL . --sync-method=method fsync pg_basebackup . plain WAL tablespace . syncfs . plain pg_basebackup WAL tablespace . syncfs recovery_init_sync_method . --no-sync . -v --verbose (verbose) . . --manifest-checksums=algorithm (checksum) . NONE CRC32C SHA224 SHA256 SHA384 SHA512. CRC32C . NONE . . SHA256 . SHA CRC32C CPU . SHA CRC-32C . . pg_verifybackup(1) . --manifest-force-encode (hex-encoded) . UTF8 . . --no-estimate-size (stream) backup_total pg_stat_progress_basebackup NULL . . . . --progress . --no-manifest . pg_verifybackup(1) . WAL . . --no-slot (replication slot) . -S ( ). (base backup) . WAL . --no-verify-checksums . . --no-clean . pg_stat_database . : -d connstr --dbname=connstr (connection string) . --dbname pg_basebackup . (replication) ~/.pgpass . PostgreSQL . . -h host --host=host (host name) . () (Unix domain socket) . PGHOST . -p port --port=port TCP . PGPORT . -s interval --status-interval=interval . . (timeout) . . -U username --username=username . -w --no-password . .pgpass . (batch jobs) . -W --password pg_basebackup . pg_basebackup . pg_basebackup . -W . : -V --version pg_basebackup . -? --help pg_basebackup . PostgreSQL libpq ( 32.15 ). PG_COLOR . always auto never. (NOTES) (checkpoint) . ( --checkpoint=fast ) pg_basebackup . tablespace PostgreSQL . tablespace . PostgreSQL . . 54.4 . plain tablespace --tablespace-mapping . tablespace plain tablespace . tar PostgreSQL tar . tablespace tar . tablespace tablespace_map base.tar . pg_basebackup 9.1 . WAL (-X stream) 9.3 tar (--format=tar) 9.5 (--incremental) 17 . pg_basebackup . (EXAMPLES) mydbserver /usr/local/pgsql/data: $ pg_basebackup -h mydbserver -D /usr/local/pgsql/data tar tablespace backup : $ pg_basebackup -D backup -Ft -z -P -tablespace bzip2: $ pg_basebackup -D - -Ft -X fetch | bzip2 > backup.tar.bz2 ( tablespace .) tablespace /opt/ts ./backup/ts : $ pg_basebackup -D backup/data -T /opt/ts=$(pwd)/backup/ts tar tablespace gzip 9 backup : $ pg_basebackup -D backup -Ft --compress=gzip:9 pg_dump(1) 27.4.6 PostgreSQL 18.6 2026 PG_BASEBACKUP(1)