PG_VERIFYBACKUP(1)
π pg_verifybackup(1) β the vibe check for your base backups
okay so listen bestie, this is the pg_verifybackup page from the PostgreSQL 14.24 Documentation, and it's genuinely one of the most underrated little tools in the whole suite. no cap. it's the one that looks at your backup and goes "girlβ¦ are you sure about this?" π«Ά
β¨ NAME β¨
pg_verifybackup β verify the integrity of a base backup of a PostgreSQL cluster. that's it. that's the whole job. and she does it flawlessly π
πΈ SYNOPSIS πΈ
pg_verifybackup [option...]
short, sweet, iconic. just vibes and flags, iykyk.
π¦ DESCRIPTION π¦
so pg_verifybackup is the tool that checks the integrity of a database cluster backup taken using pg_basebackup, and it does that against a backup_manifest generated by the server at the time of the backup. β¨
important detail, don't skip this: the backup must be stored in the"plain"format. a"tar"format backup can be checked after extracting it. no shortcuts bestie.
and here's the part where i need you to listen, because i love you and i don't want you to be disappointed later: the validation performed by pg_verifybackup does not and cannot include every check which will be performed by a running server when attempting to make use of the backup. π like, she's thorough, but she's not the server. even if you use this tool, you should still perform test restores and verify that the resulting databases work as expected and that they appear to contain the correct data. however β and this is the good part β pg_verifybackup can detect many problems that commonly occur due to storage problems or user error. so she's still eating. π
the four stages (the arc, honestly)
backup verification proceeds in four stages. here's the plot:
- the manifest read. first,
pg_verifybackupreads thebackup_manifestfile. if that file does not exist, cannot be read, is malformed, or fails verification against its own internal checksum,pg_verifybackupwill terminate with a fatal error. immediately. no mercy. π - the file comparison. second,
pg_verifybackupwill attempt to verify that the data files currently stored on disk are exactly the same as the data files which the server intended to send, with some exceptions that are described below. extra and missing files will be detected, with a few exceptions. this step will ignore the presence or absence of, or any modifications to,postgresql.auto.conf,standby.signal, andrecovery.signal, because it is expected that these files may have been created or modified as part of the process of taking the backup. she also won't complain about abackup_manifestfile in the target directory or about anything insidepg_wal, even though these files won't be listed in the backup manifest. and bestie β only files are checked; the presence or absence of directories is not verified, except indirectly: if a directory is missing, any files it should have contained will necessarily also be missing. π§ - the checksum era. next,
pg_verifybackupwill checksum all the files, compare the checksums against the values in the manifest, and emit errors for any files for which the computed checksum does not match the checksum stored in the manifest. this step is not performed for any files which produced errors in the previous step, since they are already known to have problems. files which were ignored in the previous step are also ignored in this step. efficient queen. π - the WAL moment. finally,
pg_verifybackupwill use the manifest to verify that the write-ahead log records which will be needed to recover the backup are present and that they can be read and parsed. thebackup_manifestcontains information about which write-ahead log records will be needed, andpg_verifybackupwill use that information to invokepg_waldumpto parse those write-ahead log records. the--quietflag will be used, so thatpg_waldumpwill only report errors, without producing any other output. while this level of verification is sufficient to detect obvious problems such as a missing file or one whose internal checksums do not match, they aren't extensive enough to detect every possible problem that might occur when attempting to recover. for instance, a server bug that produces write-ahead log records that have the correct checksums but specify nonsensical actions can't be detected by this method. π
a couple WAL notes, because details matter
note that if extra WAL files which are not required to recover the backup are present, they will not be checked by this tool, although a separate invocation of pg_waldump could be used for that purpose. also note that WAL verification is version-specific: you must use the version of pg_verifybackup, and thus of pg_waldump, which pertains to the backup being checked. in contrast, the data file integrity checks should work with any version of the server that generates a backup_manifest file. so the checksums are chill like that. π
π OPTIONS π
pg_verifybackup accepts the following command-line arguments:
-e,--exit-on-errorβ exit as soon as a problem with the backup is detected. if this option is not specified,pg_verifybackupwill continue checking the backup even after a problem has been detected, and will report all problems detected as errors. so likeβ¦ patience mode vs. girl-i'm-done mode. π- *
-i*path,--ignore=path ** β ignore the specified file or directory, which should be expressed as a relative path name, when comparing the list of data files actually present in the backup to those listed in thebackup_manifestfile. if a directory is specified, this option affects the entire subtree rooted at that location. complaints about extra files, missing files, file size differences, or checksum mismatches will be suppressed if the relative path name matches the specified path name. this option can be specified multiple times. π«Ά - *
-m*path,--manifest-path=path ** β use the manifest file at the specified path, rather than one located in the root of the backup directory. for when you moved the manifest somewhere safe and cute. π₯ -n,--no-parse-walβ don't attempt to parse write-ahead log data that will be needed to recover from this backup. skipping the WAL arc entirely, we love a streamlined plot. β-q,--quietβ don't print anything when a backup is successfully verified. silence = success, honestly iconic. β¨-s,--skip-checksumsβ do not verify data file checksums. the presence or absence of files and the sizes of those files will still be checked. this is much faster, because the files themselves do not need to be read. speedrun any%. π¦- *
-w*path,--wal-directory=path ** β try to parse WAL files stored in the specified directory, rather than inpg_wal. this may be useful if the backup is stored in a separate location from the WAL archive. π -V,--versionβ print thepg_verifybackupversion and exit. π-?,--helpβ show help aboutpg_verifybackupcommand line arguments, and exit. π
other options are also available β yes, those last two. we counted them. they're above. π
π EXAMPLES π
scenario one: the classic
to create a base backup of the server at mydbserver and verify the integrity of the backup:
$ pg_basebackup -h mydbserver -D /usr/local/pgsql/data
$ pg_verifybackup /usr/local/pgsql/data
look at her go. πΈ
scenario two: manifest in a secure location
to create a base backup of the server at mydbserver, move the manifest somewhere outside the backup directory, and verify the backup:
$ pg_basebackup -h mydbserver -D /usr/local/pgsql/backup1234
$ mv /usr/local/pgsql/backup1234/backup_manifest /my/secure/location/backup_manifest.1234
$ pg_verifybackup -m /my/secure/location/backup_manifest.1234 /usr/local/pgsql/backup1234
manifest said "i'm not like other files" and honestly? valid. π§
scenario three: the ignore + skip-checksums combo
to verify a backup while ignoring a file that was added manually to the backup directory, and also skipping checksum verification:
$ pg_basebackup -h mydbserver -D /usr/local/pgsql/data
$ edit /usr/local/pgsql/data/note.to.self
$ pg_verifybackup --ignore=note.to.self --skip-checksums /usr/local/pgsql/data
the note.to.self is doing main character energy and we're just letting her. π
π SEE ALSO π
pg_basebackup(1) β the one who actually made the backup. respect the source. π«Ά
π and that's the whole page bestie. go verify something. test restores still matter. periodt. π
PostgreSQL 14.24 β dated 2026. mwah. π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms