Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/pg_checksums.sgml`
01a7dc44d8844f8b46b31399b7c9340f11f95c79fb986fe40000000100000deb
 <literal>fsync</literal>, which is the default,
        <command>pg_checksums</command> will recursively open and synchronize
        all files in the data directory.  The search for files will follow
        symbolic links for the WAL directory and each configured tablespace.
       </para>
       <para>
        On Linux, <literal>syncfs</literal> may be used instead to ask the
        operating system to synchronize the whole file systems that contain the
        data directory, the WAL files, and each tablespace.  See
        <xref linkend="guc-recovery-init-sync-method"/> for information about
        the caveats to be aware of when using <literal>syncfs</literal>.
       </para>
       <para>
        This option has no effect when <option>--no-sync</option> is used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-v</option></term>
      <term><option>--verbose</option></term>
      <listitem>
       <para>
        Enable verbose output. Lists all checked files.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
       <term><option>-V</option></term>
       <term><option>--version</option></term>
       <listitem>
       <para>
        Print the <application>pg_checksums</application> version and exit.
       </para>
       </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-?</option></term>
      <term><option>--help</option></term>
       <listitem>
        <para>
         Show help about <application>pg_checksums</application> command line
         arguments, and exit.
        </para>
       </listitem>
      </varlistentry>
    </variablelist>
   </para>
 </refsect1>

 <refsect1>
  <title>Environment</title>

  <variablelist>
   <varlistentry>
    <term><envar>PGDATA</envar></term>

    <listitem>
     <para>
      Specifies the directory where the database cluster is
      stored; can be overridden using the <option>-D</option> option.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><envar>PG_COLOR</envar></term>
    <listitem>
     <para>
      Specifies whether to use color in diagnostic messages. Possible values
      are <literal>always</literal>, <literal>auto</literal> and
      <literal>never</literal>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>
  <para>
   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.
  </para>
  <para>
   When using a replication setup with tools which perform direct copies
   of relation file blocks (for example <xref linkend="app-pgrewind"/>),
   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.
  </para>
  <para>
   If <application>pg_checksums</application> is aborted or killed while
   enabling or disabling checksums, the cluster's data checksum configuration
   remains unchanged, and <application>pg_checksums</application> can be
   re-run to perform the same operation.
  </para>
 </refsect1>
</refentry>

Title: pg_checksums Options: verbose, version, help; Environment Variables; Notes
Summary
This section details further options for pg_checksums including verbose output, printing the version, and displaying help. It also outlines environment variables like PGDATA and PG_COLOR that affect the command's operation. The section concludes with important notes on enabling/disabling checksums, particularly in large clusters and replication setups, and what happens if the command is interrupted.