table of contents
PG_CHECKSUMS_EXT(1) | Application | PG_CHECKSUMS_EXT(1) |
NAME¶
pg_checksums_ext - enable, disable or check data checksums in a PostgreSQL database cluster
SYNOPSIS¶
pg_checksums_ext [option...] [[-D | --pgdata] datadir]
DESCRIPTION¶
pg_checksums_ext checks, enables or disables data checksums in a PostgreSQL cluster. The server must be shut down when enabling or disabling checksums, while verifying checksums can be done online. When verifying checksums, the exit status is zero if there are no checksum errors, and nonzero if at least one checksum failure is detected. When enabling or disabling checksums, the exit status is nonzero if the operation failed.
When verifying checksums, every file in the cluster is scanned. When enabling checksums, each relation file block with a changed checksum is rewritten in-place. Disabling checksums only updates the file pg_control.
OPTIONS¶
The following command-line options are available:
-D directory
--pgdata=directory
-c
--check
-d
--disable
-e
--enable
-f filenode
--filenode=filenode
-N
--no-sync
-P
--progress
--max-rate=rate
-v
--verbose
--debug
-V
--version
-?
--help
ENVIRONMENT¶
PGDATA
PG_COLOR
NOTES¶
Enabling checksums in a large cluster can potentially take a long time. During this operation, the cluster or other programs that write to the data directory must not be started or else data loss may occur.
When using a replication setup with tools which perform direct copies of relation file blocks (for example pg_rewind), enabling or disabling checksums can lead to page corruptions in the shape of incorrect checksums if the operation is not done consistently across all nodes. When enabling or disabling checksums in a replication setup, it is thus recommended to stop all the clusters before switching them all consistently. Destroying all standbys, performing the operation on the primary and finally recreating the standbys from scratch is also safe.
If pg_checksums_ext is aborted or killed while enabling or disabling checksums, the cluster's data checksum configuration remains unchanged, and pg_checksums_ext can be re-run to perform the same operation.
2024-10-04 | Application |