pgbackrest(1)

hey bestie! you're reading pgbackrest(1), the pgBackRest command reference ๐Ÿ’– I'm gonna spill all the tea on how to back up and restore PostgreSQL like a total boss ๐Ÿ‘‘ no cap.

โœจ NAME โœจ

pgBackRest โ€” Reliable PostgreSQL Backup & Restore


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

pgbackrest [options] [command]

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

pgBackRest is a reliable backup and restore solution for PostgreSQL that seamlessly scales up to the largest databases and workloads. it's giving main character energy for your backups, periodt ๐Ÿ’…


๐Ÿ”ฅ COMMANDS ๐Ÿ”ฅ

  • annotate โ€” add or modify a backup annotation, bestie ๐Ÿ’…
  • archive-get โ€” grab a WAL segment from the archive โœจ
  • archive-push โ€” push a WAL segment to the archive ๐Ÿš€
  • backup โ€” back up a database cluster, no cap ๐Ÿ’–
  • check โ€” check your configuration, periodt โœ…
  • expire โ€” expire backups that exceed retention, bye ๐Ÿ‘‹
  • help โ€” get help, we love that ๐Ÿซถ
  • info โ€” retrieve information about backups, iykyk ๐Ÿ“Š
  • repo-get โ€” get a file from a repository ๐Ÿ“
  • repo-ls โ€” list files in a repository ๐Ÿ“‚
  • restore โ€” restore a database cluster, slay ๐Ÿ’…
  • server โ€” pgBackRest server, the main character ๐Ÿ‘‘
  • server-ping โ€” ping pgBackRest server ๐Ÿ“
  • stanza-create โ€” create the required stanza data โœจ
  • stanza-delete โ€” delete a stanza, bye felicia ๐Ÿ‘‹
  • stanza-upgrade โ€” upgrade a stanza, glow up ๐Ÿ’ซ
  • start โ€” allow pgBackRest processes to run, go off ๐Ÿ’ฅ
  • stop โ€” stop pgBackRest processes from running, not today ๐Ÿ›‘
  • verify โ€” verify contents of a repository, fact check ๐Ÿ”
  • version โ€” get version, what's the vibe ๐Ÿ“…

๐Ÿ’… OPTIONS ๐Ÿ’…

๐ŸŽ€ Annotate Options ๐ŸŽ€

  • --set โ€” the backup set to annotate, bestie ๐Ÿ’…

๐ŸŽ€ Archive Options ๐ŸŽ€

  • --archive-async โ€” push or get WAL segments asynchronously, no cap โœจ
  • --archive-get-queue-max โ€” max size of the pgBackRest archive-get queue, fr fr ๐Ÿ“ฆ
  • --archive-missing-retry โ€” retry missing WAL segment, we try again ๐Ÿ’ช
  • --archive-push-batch-size โ€” max amount of WAL to push per asynchronous run, batch it ๐Ÿš€
  • --archive-push-queue-max โ€” max size of the PostgreSQL archive queue, queue it up ๐Ÿงต
  • --archive-timeout โ€” archive timeout, tick tock โฐ

๐ŸŽ€ Backup Options ๐ŸŽ€

  • --annotation โ€” annotate backup with user-defined key/value pairs, add your own tags ๐Ÿท๏ธ
  • --archive-check โ€” check that WAL segments are in the archive before backup completes, verify it โœ…
  • --archive-copy โ€” copy WAL segments needed for consistency to the backup, keep it consistent ๐Ÿ’พ
  • --archive-mode-check โ€” check the PostgreSQL archive_mode setting, check the vibe ๐Ÿ”
  • --backup-standby โ€” backup from the standby cluster, standby slay ๐Ÿ’…
  • --checksum-page โ€” validate data page checksums, check those sums ๐Ÿงฎ
  • --exclude โ€” exclude paths/files from the backup, no thanks ๐Ÿ™…
  • --expire-auto โ€” automatically run the expire command after a successful backup, auto-expire โœจ
  • --force โ€” force an offline backup, do it anyway ๐Ÿ’ช
  • --manifest-save-threshold โ€” manifest save threshold during backup, save that manifest ๐Ÿ“
  • --online โ€” perform an online backup, online era ๐ŸŒ
  • --resume โ€” allow resume of failed backup, pick up where you left off ๐Ÿ”„
  • --start-fast โ€” force a checkpoint to start backup quickly, fast start ๐Ÿ
  • --type โ€” backup type, what type of backup? ๐Ÿค”

๐ŸŽ€ Expire Options ๐ŸŽ€

  • --archive-expire-before โ€” remove WAL archive earlier than the specified WAL segment, expire before ๐Ÿ—‘๏ธ
  • --oldest โ€” expire the oldest eligible backup set, oldest out ๐Ÿ‘ต
  • --set โ€” the backup set to expire, bye set ๐Ÿ’…

๐ŸŽ€ General Options ๐ŸŽ€

  • --allow-root โ€” allow the command to run as the root user, root access iykyk ๐Ÿ‘‘
  • --buffer-size โ€” buffer size for I/O operations, buffer it ๐Ÿ“ฆ
  • --cmd โ€” pgBackRest command, the command ๐ŸŽฎ
  • --cmd-ssh โ€” SSH client command, ssh it ๐Ÿ”‘
  • --compress โ€” use file compression, zip it ๐Ÿ—œ๏ธ
  • --compress-level โ€” file compression level, level up ๐Ÿ†™
  • --compress-level-network โ€” network compression level, network compress ๐ŸŒ
  • --compress-type โ€” file compression type, type of compress ๐Ÿ“
  • --config โ€” pgBackRest configuration file, config file ๐Ÿ“„
  • --config-include-path โ€” path to additional pgBackRest configuration files, extra configs ๐Ÿ“‚
  • --config-path โ€” base path of pgBackRest configuration files, config home ๐Ÿ 
  • --db-timeout โ€” database query timeout, timeout for db โณ
  • --delta โ€” restore or backup using checksums, delta it ๐Ÿ”„
  • --dry-run โ€” execute a dry-run for the command, test run ๐Ÿงช
  • --io-timeout โ€” I/O timeout, timeout for io โฐ
  • --lock-path โ€” path where lock files are stored, lock it up ๐Ÿ”’
  • --neutral-umask โ€” use a neutral umask, neutral mask ๐ŸŽญ
  • --priority โ€” set process priority, priority level ๐Ÿ“ˆ
  • --process-max โ€” max processes to use for compress/transfer, max processes ๐Ÿš€
  • --protocol-timeout โ€” protocol timeout, timeout for protocol โฑ๏ธ
  • --raw โ€” do not transform data, raw data ๐Ÿฃ
  • --sck-keep-alive โ€” keep-alive enable, keep it alive ๐Ÿ’“
  • --spool-path โ€” path where transient data is stored, spool path ๐Ÿ—‚๏ธ
  • --stanza โ€” defines the stanza, stanza vibes ๐ŸŽต
  • --tcp-keep-alive-count โ€” keep-alive count, count it ๐Ÿ”ข
  • --tcp-keep-alive-idle โ€” keep-alive idle time, idle time ๐Ÿ’ค
  • --tcp-keep-alive-interval โ€” keep-alive interval time, interval time โฒ๏ธ
  • --tls-cipher-12 โ€” allowed TLSv1.2 cipher suites, tls 1.2 ciphers ๐Ÿ”
  • --tls-cipher-13 โ€” allowed TLSv1.3 cipher suites, tls 1.3 ciphers ๐Ÿ”

๐ŸŽ€ Help Options ๐ŸŽ€

  • --help โ€” display help, help me ๐Ÿ†˜
  • --version โ€” display version, version check ๐Ÿ“…

๐ŸŽ€ Info Options ๐ŸŽ€

  • --detail-level โ€” output detail level, detail level ๐Ÿ”
  • --output โ€” output format, output format ๐Ÿ“„
  • --set โ€” backup set to detail, detail that set ๐Ÿ’…
  • --type โ€” filter on backup type, filter by type ๐ŸŽฏ

๐ŸŽ€ Log Options ๐ŸŽ€

  • --log-level-console โ€” level for console logging, console log level ๐Ÿ–ฅ๏ธ
  • --log-level-file โ€” level for file logging, file log level ๐Ÿ“
  • --log-level-stderr โ€” level for stderr logging, stderr log level ๐Ÿšจ
  • --log-path โ€” path where log files are stored, log path ๐Ÿ“‚
  • --log-subprocess โ€” enable logging in subprocesses, log subprocesses ๐Ÿ‘ถ
  • --log-timestamp โ€” enable timestamp in logging, timestamp it โฐ

๐ŸŽ€ Maintainer Options ๐ŸŽ€

  • --archive-header-check โ€” check PostgreSQL version/id in WAL headers, check WAL headers ๐Ÿ”
  • --page-header-check โ€” check PostgreSQL page headers, check page headers ๐Ÿ“„
  • --pg-version-force โ€” force PostgreSQL version, force version ๐Ÿ’ช

๐ŸŽ€ Repo-get Options ๐ŸŽ€

  • --ignore-missing โ€” ignore missing source file, ignore missing ๐Ÿšซ

๐ŸŽ€ Repo-ls Options ๐ŸŽ€

  • --filter โ€” filter output with a regular expression, filter it ๐Ÿ”
  • --output โ€” output format, output format ๐Ÿ“„
  • --recurse โ€” include all subpaths in output, recurse it ๐Ÿ”„
  • --sort โ€” sort output ascending, descending, or none, sort it ๐Ÿ”ข

๐ŸŽ€ Repository Options ๐ŸŽ€

  • --repo โ€” set repository, set repo ๐Ÿ“š
  • --repo-azure-account โ€” Azure repository account, azure account โ˜๏ธ
  • --repo-azure-container โ€” Azure repository container, azure container ๐Ÿ“ฆ
  • --repo-azure-endpoint โ€” Azure repository endpoint, azure endpoint ๐ŸŒ
  • --repo-azure-key โ€” Azure repository key, azure key ๐Ÿ”‘
  • --repo-azure-key-type โ€” Azure repository key type, azure key type ๐Ÿ—๏ธ
  • --repo-azure-uri-style โ€” Azure URI Style, azure uri style ๐ŸŽจ
  • --repo-block โ€” enable block incremental backup, block incremental ๐Ÿงฑ
  • --repo-bundle โ€” bundle files in repository, bundle it ๐ŸŽ
  • --repo-bundle-limit โ€” limit for file bundles, bundle limit ๐Ÿšง
  • --repo-bundle-size โ€” target size for file bundles, bundle size ๐Ÿ“
  • --repo-cipher-pass โ€” repository cipher passphrase, cipher pass ๐Ÿ”
  • --repo-cipher-type โ€” cipher used to encrypt the repository, cipher type ๐Ÿ”’
  • --repo-gcs-bucket โ€” GCS repository bucket, gcs bucket ๐Ÿชฃ
  • --repo-gcs-endpoint โ€” GCS repository endpoint, gcs endpoint ๐ŸŒ
  • --repo-gcs-key โ€” GCS repository key, gcs key ๐Ÿ”‘
  • --repo-gcs-key-type โ€” GCS repository key type, gcs key type ๐Ÿ—๏ธ
  • --repo-gcs-user-project โ€” GCS project ID, gcs project id ๐Ÿ†”
  • --repo-hardlink โ€” hardlink files between backups in the repository, hardlink it ๐Ÿ”—
  • --repo-host โ€” repository host when operating remotely, repo host remotely ๐ŸŒ
  • --repo-host-ca-file โ€” repository host certificate authority file, ca file ๐Ÿ“œ
  • --repo-host-ca-path โ€” repository host certificate authority path, ca path ๐Ÿ“‚
  • --repo-host-cert-file โ€” repository host certificate file, cert file ๐Ÿ“„
  • --repo-host-cmd โ€” repository host pgBackRest command, host command ๐ŸŽฎ
  • --repo-host-config โ€” pgBackRest repository host configuration file, host config ๐Ÿ“„
  • --repo-host-config-include-path โ€” pgBackRest repository host configuration include path, host config include path ๐Ÿ“‚
  • --repo-host-config-path โ€” pgBackRest repository host configuration path, host config path ๐Ÿ“
  • --repo-host-key-file โ€” repository host key file, host key file ๐Ÿ”‘
  • --repo-host-port โ€” repository host port when repo-host is set, host port ๐Ÿšช
  • --repo-host-type โ€” repository host protocol type, host type ๐Ÿ–ฅ๏ธ
  • --repo-host-user โ€” repository host user when repo-host is set, host user ๐Ÿ‘ค
  • --repo-path โ€” path where backups and archive are stored, repo path ๐Ÿ“‚
  • --repo-retention-archive โ€” number of backups worth of continuous WAL to retain, retention archive ๐Ÿ—„๏ธ
  • --repo-retention-archive-type โ€” backup type for WAL retention, retention archive type ๐Ÿ—‚๏ธ
  • --repo-retention-diff โ€” number of differential backups to retain, retention diff ๐Ÿ”„
  • --repo-retention-full โ€” full backup retention count/time, retention full ๐Ÿ’ฏ
  • --repo-retention-full-type โ€” retention type for full backups, retention full type ๐Ÿ—“๏ธ
  • --repo-retention-history โ€” days of backup history manifests to retain, retention history ๐Ÿ“œ
  • --repo-s3-bucket โ€” S3 repository bucket, s3 bucket ๐Ÿชฃ
  • --repo-s3-endpoint โ€” S3 repository endpoint, s3 endpoint ๐ŸŒ
  • --repo-s3-key โ€” S3 repository access key, s3 access key ๐Ÿ”‘
  • --repo-s3-key-secret โ€” S3 repository secret access key, s3 secret key ๐Ÿ”
  • --repo-s3-key-type โ€” S3 repository key type, s3 key type ๐Ÿ—๏ธ
  • --repo-s3-kms-key-id โ€” S3 repository KMS key, s3 kms key ๐Ÿ”‘
  • --repo-s3-process-cmd โ€” S3 authentication process command, s3 process cmd ๐ŸŽฎ
  • --repo-s3-region โ€” S3 repository region, s3 region ๐ŸŒ
  • --repo-s3-requester-pays โ€” S3 repository requester pays, requester pays ๐Ÿ’ธ
  • --repo-s3-role โ€” S3 repository role, s3 role ๐Ÿ‘‘
  • --repo-s3-service โ€” S3 signing service, s3 service ๐Ÿ› ๏ธ
  • --repo-s3-sse-customer-key โ€” S3 repository SSE customer key, sse customer key ๐Ÿ”
  • --repo-s3-sts-host โ€” S3 repository STS endpoint, sts host ๐ŸŒ

  • --repo-s3-token โ€” the security token for your S3 repo ๐Ÿ” keep it secret, keep it safe
  • --repo-s3-uri-style โ€” the URI style for S3, so the repo knows how to talk to it โœจ
  • --repo-sftp-host โ€” which host your SFTP repo lives on ๐Ÿ–ฅ๏ธ
  • --repo-sftp-host-fingerprint โ€” the host fingerprint for that SFTP repo host ๐Ÿ”Ž
  • --repo-sftp-host-key-check-type โ€” what kind of host key check you want for SFTP ๐Ÿง
  • --repo-sftp-host-key-hash-type โ€” the hash type for the SFTP repo host key ๐Ÿ”‘
  • --repo-sftp-host-port โ€” the port on the SFTP repo host ๐Ÿšช
  • --repo-sftp-host-user โ€” the user logging into the SFTP repo host ๐Ÿ‘ค
  • --repo-sftp-known-host โ€” your SFTP known hosts file ๐Ÿ“–
  • --repo-sftp-private-key-file โ€” the SFTP private key file ๐Ÿ—๏ธ
  • --repo-sftp-private-key-passphrase โ€” the passphrase for that private key ๐Ÿคซ
  • --repo-sftp-public-key-file โ€” the SFTP public key file that goes with it ๐Ÿ”“
  • --repo-storage-ca-file โ€” the CA file for repo storage ๐Ÿ“œ
  • --repo-storage-ca-path โ€” the CA path for repo storage ๐Ÿ›ค๏ธ
  • --repo-storage-host โ€” the repo storage host ๐Ÿ 
  • --repo-storage-port โ€” the repo storage port ๐Ÿšช
  • --repo-storage-tag โ€” repo storage tag(s) ๐Ÿท๏ธ
  • --repo-storage-upload-chunk-size โ€” how big the upload chunks are when you push to repo storage ๐Ÿงฑ
  • --repo-storage-verify-tls โ€” whether to verify the repo storage certificate ๐Ÿ“œโœ…
  • --repo-symlink โ€” create symlinks inside the repository ๐Ÿ”—
  • --repo-target-time โ€” the target time for the repository โฐ
  • --repo-type โ€” the type of storage your repository uses ๐Ÿ—„๏ธ

๐ŸŒˆ Restore Options ๐ŸŒˆ

  • --archive-mode โ€” keep archiving on for the restored cluster, or turn it off ๐Ÿ“ฆ
  • --db-exclude โ€” restore everything EXCEPT the databases you name ๐Ÿ™…โ€โ™€๏ธ
  • --db-include โ€” restore ONLY the databases you name ๐Ÿ’ฏ
  • --force โ€” force the restore ๐Ÿ’ช
  • --link-all โ€” restore all the symlinks ๐Ÿ”—
  • --link-map โ€” change where a symlink points ๐Ÿ—บ๏ธ
  • --recovery-option โ€” set an option over in postgresql.auto.conf or recovery.conf โš™๏ธ
  • --set โ€” which backup set to restore ๐Ÿ“ฆ
  • --tablespace-map โ€” restore one tablespace into the directory you choose ๐Ÿ“‚
  • --tablespace-map-all โ€” restore every tablespace into the directory you choose ๐Ÿ“‚๐Ÿ“‚
  • --target โ€” the recovery target ๐ŸŽฏ
  • --target-action โ€” what to do the second the recovery target is reached ๐ŸŽฌ
  • --target-exclusive โ€” stop right before the recovery target is reached ๐Ÿ›‘
  • --target-timeline โ€” recover along a timeline ๐Ÿ•ฐ๏ธ
  • --type โ€” the recovery type ๐Ÿ”„

๐Ÿ–ฅ๏ธ Server Options ๐Ÿ–ฅ๏ธ

  • --tls-server-address โ€” the TLS server address ๐Ÿ“
  • --tls-server-auth โ€” which clients the TLS server has authorized โœ…
  • --tls-server-ca-file โ€” the TLS server's certificate authorities ๐Ÿ“œ
  • --tls-server-cert-file โ€” the TLS server certificate file ๐Ÿชช
  • --tls-server-key-file โ€” the TLS server key file ๐Ÿ”‘
  • --tls-server-port โ€” the TLS server port ๐Ÿšช

๐Ÿงš Stanza Options ๐Ÿงš

  • --pg-database โ€” the PostgreSQL database ๐Ÿ˜
  • --pg-host โ€” the PostgreSQL host, for when you're operating remotely ๐Ÿ›ฐ๏ธ
  • --pg-host-ca-file โ€” the certificate authority file for the PostgreSQL host ๐Ÿ“œ
  • --pg-host-ca-path โ€” the certificate authority path for the PostgreSQL host ๐Ÿ›ค๏ธ
  • --pg-host-cert-file โ€” the certificate file for the PostgreSQL host ๐Ÿชช
  • --pg-host-cmd โ€” the pgBackRest command to run on the PostgreSQL host ๐Ÿƒโ€โ™€๏ธ
  • --pg-host-config โ€” the pgBackRest database host configuration file ๐Ÿ“
  • --pg-host-config-include-path โ€” the pgBackRest database host configuration include path ๐Ÿ“
  • --pg-host-config-path โ€” the pgBackRest database host configuration path ๐Ÿ“
  • --pg-host-key-file โ€” the key file for the PostgreSQL host ๐Ÿ”‘
  • --pg-host-port โ€” the PostgreSQL host port, used when pg-host is set ๐Ÿšช
  • --pg-host-type โ€” the PostgreSQL host protocol type ๐Ÿ”Œ
  • --pg-host-user โ€” the logon user for the PostgreSQL host, used when pg-host is set ๐Ÿ‘ค
  • --pg-path โ€” the PostgreSQL data directory ๐Ÿ“‚
  • --pg-port โ€” the PostgreSQL port ๐Ÿšช
  • --pg-socket-path โ€” the PostgreSQL unix socket path ๐Ÿงฆ
  • --pg-user โ€” the PostgreSQL database user ๐Ÿ‘ค

โœจ Stanza-create Options โœจ

  • --online โ€” create the stanza on a cluster that's currently online ๐ŸŒ

๐Ÿ—‘๏ธ Stanza-delete Options ๐Ÿ—‘๏ธ

  • --force โ€” force the stanza delete ๐Ÿ’ฅ

โฌ†๏ธ Stanza-upgrade Options โฌ†๏ธ

  • --online โ€” update a cluster that's online ๐ŸŒ

๐Ÿ›‘ Stop Options ๐Ÿ›‘

  • --force โ€” force ALL the pgBackRest processes to stop ๐Ÿ›‘

๐Ÿ” Verify Options ๐Ÿ”

  • --output โ€” the output type ๐Ÿ“ค
  • --set โ€” the backup set you're verifying ๐Ÿ“ฆ
  • --verbose โ€” verbose output, bestie ๐Ÿ—ฃ๏ธ

๐Ÿท๏ธ Version Options ๐Ÿท๏ธ

  • --output โ€” the output type ๐Ÿ“ค

๐Ÿ“ FILES ๐Ÿ“

These are the spots pgBackRest calls home ๐Ÿก no cap:

  • /etc/pgbackrest/pgbackrest.conf
  • /var/lib/pgbackrest
  • /var/log/pgbackrest
  • /var/spool/pgbackrest
  • /tmp/pgbackrest

๐ŸŽ€ EXAMPLES ๐ŸŽ€

  • Create a backup of the PostgreSQL main cluster ๐Ÿ’พ:
$ pgbackrest --stanza=main backup

The main cluster should be configured in /etc/pgbackrest/pgbackrest.conf ๐Ÿ“

  • Show all available backups ๐Ÿ‘€:
$ pgbackrest info
  • Show all available backups for a specific cluster ๐ŸŽฏ:
$ pgbackrest --stanza=main info
  • Show backup specific options ๐Ÿ› ๏ธ:
$ pgbackrest help backup

๐Ÿ’œ SEE ALSO ๐Ÿ’œ


and that's the whole page, bestie ๐Ÿซถ this is the pgbackrest(1) manual, dated 19 August 2026 โ€” go forth and back up literally everything, you icon ๐Ÿ‘‘โœจ

๐Ÿ“ฆ where this page comes from