Home Explore Blog CI



postgresql

15th chunk of `doc/src/sgml/ref/pg_basebackup.sgml`
cb02304f40d56fc13fbce15cd28422135b2368f3a9f1199a0000000100000817
 <application>pg_basebackup</application> will appear to be idle.
  </para>

  <para>
   The backup will include all files in the data directory and tablespaces,
   including the configuration files and any additional files placed in the
   directory by third parties, except certain temporary files managed by
   PostgreSQL and operating system files.  But only regular files and
   directories are copied, except that
   symbolic links used for tablespaces are preserved.  Symbolic links pointing
   to certain directories known to PostgreSQL are copied as empty directories.
   Other symbolic links and special device files are skipped.
   See <xref linkend="protocol-replication"/> for the precise details.
  </para>

  <para>
   In plain format, tablespaces will be backed up to the same path
   they have on the source server, unless the
   option <literal>--tablespace-mapping</literal> is used.  Without
   this option, running a plain format base backup on the same host as the
   server will not work if tablespaces are in use, because the backup would
   have to be written to the same directory locations as the original
   tablespaces.
  </para>

  <para>
   When tar format is used, it is the user's responsibility to unpack each
   tar file before starting a PostgreSQL server that uses the data. If there
   are additional tablespaces, the
   tar files for them need to be unpacked in the correct locations. In this
   case the symbolic links for those tablespaces will be created by the server
   according to the contents of the <filename>tablespace_map</filename> file that is
   included in the <filename>base.tar</filename> file.
  </para>

  <para>
   <application>pg_basebackup</application> works with servers of the same
   or older major version, down to 9.1. However, WAL streaming mode (<literal>-X
   stream</literal>) only works with server version 9.3 and later, the tar format
   (<literal>--format=tar</literal>) only works with server version 9.5
   and later, and incremental backup (<literal>--incremental</literal>) only works
   with

Title: pg_basebackup Backup Contents, Tablespaces, and Compatibility
Summary
This section describes the contents of a pg_basebackup backup, including all files in the data directory and tablespaces (except certain temporary and OS files). It highlights how tablespaces are handled in plain and tar formats, emphasizing the importance of unpacking tar files correctly. The section also covers pg_basebackup's compatibility with different PostgreSQL server versions, noting specific feature limitations for older versions.