pg_verifybackup

A core utility for verifying the integrity of a backup created with pg_basebackup

pg_verifybackup is a core utility for verifying the integrity of a backup created with pg_basebackup using the backup manifest it created.

pg_verifybackup was added in PostgreSQL 13.

Usage

In its simplest form, pg_verifybackup is executed by providing the path of the data directory which contains the backup manifest file, and it will report either successful verification or details of files containing errors.

pg_verifybackup should be executed after a backup has been made, but before the server has been started. If the server has been started, it will report errors.

Additional options are available to control verbosity, the location of various files and directories (the backup manifest itself, the pg_wal directory etc.); see the documentation and/or the output of pg_verifybackup --help for further details.

Certain files where post-backup modifications are likely () will be excluded from the verification, as will any files/paths specified with the -i/--ignore option.

Note that unlike many other utilities, pg_verifybackup does not optionally accept the -D/--pgdata option to specify the data directory; the rationale for this inconsistency can be found here.

Change history

Examples

$ pg_basebackup -l "base backup" -D /path/to/data -h node1 -U repuser -c fast -X stream --no-slot --verbose
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/4000028 on timeline 1
pg_basebackup: starting background WAL receiver
pg_basebackup: write-ahead log end point: 0/4000100
pg_basebackup: waiting for background process to finish streaming ...
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed

$ pg_verifybackup /path/to/data
backup successfully verified

Categories

Backup, Core utility

See also

backup manifest, pg_basebackup