]> begriffs open source - ai-pg/blob - full-docs/txt/app-pgchecksums.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / app-pgchecksums.txt
1
2 pg_checksums
3
4    pg_checksums — enable, disable or check data checksums in a PostgreSQL
5    database cluster
6
7 Synopsis
8
9    pg_checksums [option...] [[ -D | --pgdata ]datadir]
10
11 Description
12
13    pg_checksums checks, enables or disables data checksums in a PostgreSQL
14    cluster. The server must be shut down cleanly before running
15    pg_checksums. When verifying checksums, the exit status is zero if
16    there are no checksum errors, and nonzero if at least one checksum
17    failure is detected. When enabling or disabling checksums, the exit
18    status is nonzero if the operation failed.
19
20    When verifying checksums, every file in the cluster is scanned. When
21    enabling checksums, each relation file block with a changed checksum is
22    rewritten in-place. Disabling checksums only updates the file
23    pg_control.
24
25 Options
26
27    The following command-line options are available:
28
29    -D directory
30           --pgdata=directory
31           Specifies the directory where the database cluster is stored.
32
33    -c
34           --check
35           Checks checksums. This is the default mode if nothing else is
36           specified.
37
38    -d
39           --disable
40           Disables checksums.
41
42    -e
43           --enable
44           Enables checksums.
45
46    -f filenode
47           --filenode=filenode
48           Only validate checksums in the relation with filenode filenode.
49
50    -N
51           --no-sync
52           By default, pg_checksums will wait for all files to be written
53           safely to disk. This option causes pg_checksums to return
54           without waiting, which is faster, but means that a subsequent
55           operating system crash can leave the updated data directory
56           corrupt. Generally, this option is useful for testing but should
57           not be used on a production installation. This option has no
58           effect when using --check.
59
60    -P
61           --progress
62           Enable progress reporting. Turning this on will deliver a
63           progress report while checking or enabling checksums.
64
65    --sync-method=method
66           When set to fsync, which is the default, pg_checksums will
67           recursively open and synchronize all files in the data
68           directory. The search for files will follow symbolic links for
69           the WAL directory and each configured tablespace.
70
71           On Linux, syncfs may be used instead to ask the operating system
72           to synchronize the whole file systems that contain the data
73           directory, the WAL files, and each tablespace. See
74           recovery_init_sync_method for information about the caveats to
75           be aware of when using syncfs.
76
77           This option has no effect when --no-sync is used.
78
79    -v
80           --verbose
81           Enable verbose output. Lists all checked files.
82
83    -V
84           --version
85           Print the pg_checksums version and exit.
86
87    -?
88           --help
89           Show help about pg_checksums command line arguments, and exit.
90
91 Environment
92
93    PGDATA
94           Specifies the directory where the database cluster is stored;
95           can be overridden using the -D option.
96
97    PG_COLOR
98           Specifies whether to use color in diagnostic messages. Possible
99           values are always, auto and never.
100
101 Notes
102
103    Enabling checksums in a large cluster can potentially take a long time.
104    During this operation, the cluster or other programs that write to the
105    data directory must not be started or else data loss may occur.
106
107    When using a replication setup with tools which perform direct copies
108    of relation file blocks (for example pg_rewind), enabling or disabling
109    checksums can lead to page corruptions in the shape of incorrect
110    checksums if the operation is not done consistently across all nodes.
111    When enabling or disabling checksums in a replication setup, it is thus
112    recommended to stop all the clusters before switching them all
113    consistently. Destroying all standbys, performing the operation on the
114    primary and finally recreating the standbys from scratch is also safe.
115
116    If pg_checksums is aborted or killed while enabling or disabling
117    checksums, the cluster's data checksum configuration remains unchanged,
118    and pg_checksums can be re-run to perform the same operation.