<!--
doc/src/sgml/ref/pg_combinebackup.sgml
PostgreSQL documentation
-->
<refentry id="app-pgcombinebackup">
<indexterm zone="app-pgcombinebackup">
<primary>pg_combinebackup</primary>
</indexterm>
<refmeta>
<refentrytitle><application>pg_combinebackup</application></refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>Application</refmiscinfo>
</refmeta>
<refnamediv>
<refname>pg_combinebackup</refname>
<refpurpose>reconstruct a full backup from an incremental backup and dependent backups</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>pg_combinebackup</command>
<arg rep="repeat"><replaceable>option</replaceable></arg>
<arg rep="repeat"><replaceable>backup_directory</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<application>pg_combinebackup</application> is used to reconstruct a
synthetic full backup from an
<link linkend="backup-incremental-backup">incremental backup</link> and the
earlier backups upon which it depends.
</para>
<para>
Specify all of the required backups on the command line from oldest to newest.
That is, the first backup directory should be the path to the full backup, and
the last should be the path to the final incremental backup
that you wish to restore. The reconstructed backup will be written to the
output directory specified by the <option>-o</option> option.
</para>
<para>
<application>pg_combinebackup</application> will attempt to verify
that the backups you specify form a legal backup chain from which a correct
full backup can be reconstructed. However, it is not designed to help you
keep track of which backups depend on which other backups. If you remove
one or more of the previous backups upon which your incremental
backup relies, you will not be able to restore it. Moreover,
<application>pg_combinebackup</application> only attempts to verify that the
backups have the correct relationship to each other, not that each
individual backup is intact; for that, use
<xref linkend="app-pgverifybackup" />.
</para>
<para>
Since the output of <application>pg_combinebackup</application> is a
synthetic full backup, it can be used as an input to a future invocation of
<application>pg_combinebackup</application>. The synthetic full backup would
be specified on the command line in lieu of the chain of backups from which
it was reconstructed.
</para>
</refsect1>
<refsect1>
<title>Options</title>
<para>
<variablelist>
<varlistentry>
<term><option>-d</option></term>
<term><option>--debug</option></term>
<listitem>
<para>
Print lots of debug logging output on <filename>stderr</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-k</option></term>
<term><option>--link</option></term>
<listitem>
<para>
Use hard links instead of copying files to the synthetic backup.
Reconstruction of the synthetic backup might be faster (no file copying)
and use less disk space, but care must be taken when using the output
directory, because any modifications to that directory (for example,
starting the server) can also affect the input directories. Likewise,
changes to the input directories (for example, starting the server on
the full backup) could affect the output directory. Thus, this option
is best used when the input directories are only copies that will be
removed after <application>pg_combinebackup</application> has completed.
</para>
<para>
Requires that the input backups and the output directory are in the
same file system.
</para>
<para>
If a backup manifest is not available or does not contain checksum of
the right type, hard links will still be created, but the file will be