Backup and Recovery of EDB Postgres Advanced Server 18 (EPAS) with Barman – Full, Incremental and Point-in-Time Recovery

In the previous post we installed EDB Postgres Advanced Server 18 (EPAS) on Red Hat Enterprise Linux 10 and created a cluster in the Oracle compatible Redwood mode. A database is only as good as its last tested restore, so the next step is a proper backup and recovery setup. In this post we use Barman (Backup and Recovery Manager), the open source backup tool maintained by EDB, on a dedicated backup server.

We will take a full backup and two block-level incremental backups of the Redwood cluster, restore the latest incremental backup and finally perform a point-in-time recovery (PITR) after an “accidental” DROP TABLE.

Prerequisites

EPAS Serverlin8: RHEL 10 with EPAS 18 and the Redwood cluster in /var/lib/edb/as18/data (port 5444), installed as described in the previous post.
Backup Serverlin6: a second RHEL 10 VM (minimum 2 vCPUs, 4GB RAM). Plan the backup storage with at least 2–3 times the database size for base backups and WAL files.
BarmanBarman 3.21 (current version at the time of writing) from the EDB repository.
EDB AccountThe EDB repository token from the previous post.
Name ResolutionBoth hosts can resolve each other by name (DNS or /etc/hosts).
Root/Sudo AccessFull administrative privileges on both VMs.

How It Works

Barman supports several backup methods. We use backup_method = postgres, the streaming setup recommended for current Postgres versions:

  • Base backups are taken with pg_basebackup over the streaming replication protocol. No SSH connection is needed for backups.
  • WAL files are streamed continuously with pg_receivewal through a replication slot. No archive_command is needed and the potential data loss (RPO) is close to zero.
  • Incremental backups use the native block-level incremental backup feature introduced in PostgreSQL 17. The server tracks changed blocks via WAL summarization (summarize_wal), and pg_basebackup --incremental copies only the blocks changed since the parent backup.
  • Restores of incremental backups are done by combining the chain (full backup + incrementals) with pg_combinebackup. The restored files are copied with rsync over SSH to the target server.

1. Prepare the EPAS Server (lin8)

1.1 Enable WAL summarization

Block-level incremental backups require summarize_wal = on, and it must be enabled before the first full backup is taken. The parameter only needs a reload. The other relevant parameters (wal_level = replica, max_wal_senders, max_replication_slots) already have suitable default values.

# run as root on lin8
su - enterprisedb -c "psql -d edb -c \"alter system set summarize_wal = on;\""
su - enterprisedb -c "psql -d edb -c \"select pg_reload_conf();\""
su - enterprisedb -c "psql -d edb -c \"show summarize_wal;\""
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "psql -d edb -c \"alter system set summarize_wal = on;\""
su - enterprisedb -c "psql -d edb -c \"select pg_reload_conf();\""
su - enterprisedb -c "psql -d edb -c \"show summarize_wal;\""
ALTER SYSTEM
 pg_reload_conf
----------------
 t
(1 row)

 summarize_wal
---------------
 on
(1 row)

[root@lin8 ~]#

1.2 Create the Barman database users

Barman uses two database users: barman for the regular connection (it does not need to be a superuser, only some privileges to control backups) and streaming_barman with the REPLICATION attribute for pg_basebackup and pg_receivewal:

# run as root on lin8
su - enterprisedb -c "psql -d edb" <<'EOF'
create user barman password 'changeme';
grant execute on function pg_backup_start(text, boolean) to barman;
grant execute on function pg_backup_stop(boolean) to barman;
grant execute on function pg_switch_wal() to barman;
grant execute on function pg_create_restore_point(text) to barman;
grant pg_read_all_settings to barman;
grant pg_read_all_stats to barman;
grant pg_checkpoint to barman;
create user streaming_barman replication password 'changeme';
EOF
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "psql -d edb" <<'EOF'
create user barman password 'changeme';
grant execute on function pg_backup_start(text, boolean) to barman;
grant execute on function pg_backup_stop(boolean) to barman;
grant execute on function pg_switch_wal() to barman;
grant execute on function pg_create_restore_point(text) to barman;
grant pg_read_all_settings to barman;
grant pg_read_all_stats to barman;
grant pg_checkpoint to barman;
create user streaming_barman replication password 'changeme';
EOF
CREATE ROLE
GRANT
GRANT
GRANT
GRANT
GRANT ROLE
GRANT ROLE
GRANT ROLE
CREATE ROLE
[root@lin8 ~]#

1.3 Allow connections from the backup server

The pg_hba.conf from the previous post only contains the line host all all 0.0.0.0/0 scram-sha-256. The keyword all in the database column does not match replication connections, so we need an additional entry for the streaming user:

# run as root on lin8
cat >> /var/lib/edb/as18/data/pg_hba.conf <<'EOF'
# Barman streaming connections from the backup server lin6
host replication streaming_barman 11.1.1.186/32 scram-sha-256
EOF
su - enterprisedb -c "psql -d edb -c \"select pg_reload_conf();\""

1.4 Install rsync

For restores Barman copies the files with rsync over SSH, so rsync is needed on the EPAS server as well:

# run as root on lin8
dnf -y install rsync

2. Install and Configure Barman (lin6)

2.1 Prepare the OS and add the EDB repository

Prepare the backup server exactly like the EPAS server in steps 1.2 and 1.3 of the previous post (EPEL, CodeReady Builder and the EDB “enterprise” repository with your token). Barman is available both in the EDB repositories and in the PGDG repositories. Stick to one source: the packages from different repositories use different configuration layouts and should not be mixed.

2.2 Install Barman and the EPAS client tools

Barman calls pg_basebackup, pg_receivewal and, for incremental restores, pg_combinebackup. We install the EPAS 18 client package so that the tools match the server version:

# run as root on lin6
dnf -y install barman edb-as18-server-client rsync
barman --version
ls -l /usr/edb/as18/bin/{pg_basebackup,pg_receivewal,pg_combinebackup}
cat /etc/cron.d/barman
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
dnf -y install barman edb-as18-server-client rsync
barman --version
ls -l /usr/edb/as18/bin/{pg_basebackup,pg_receivewal,pg_combinebackup}
cat /etc/cron.d/barman
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 10 - x86_64                                                                                 3.5 MB/s | 7.3 MB     00:02
Red Hat CodeReady Linux Builder for RHEL 10 x86_64 (RPMs)                                                                       1.1 MB/s | 1.7 MB     00:01
Red Hat Enterprise Linux 10 for x86_64 - AppStream (RPMs)                                                                        11 kB/s | 4.1 kB     00:00
Red Hat Enterprise Linux 10 for x86_64 - BaseOS (RPMs)                                                                           12 kB/s | 4.1 kB     00:00
Package rsync-3.5.0-4.el10_3.x86_64 is already installed.
Dependencies resolved.
================================================================================================================================================================
 Package                                    Architecture               Version                                Repository                                   Size
================================================================================================================================================================
Installing:
 barman                                     x86_64                     3.21.0-1.el10                          enterprisedb-enterprise                     244 k
 edb-as18-server-client                     x86_64                     18.7.0-1.el10                          enterprisedb-enterprise                     2.0 M
Installing dependencies:
 edb-as18-server-libs                       x86_64                     18.7.0-1.el10                          enterprisedb-enterprise                     705 k
 edb-python312                              x86_64                     3.12.16-2edb.el10                      enterprisedb-enterprise                      17 M
 edb-python312-barman                       x86_64                     3.21.0-1.el10                          enterprisedb-enterprise                      36 M

Transaction Summary
================================================================================================================================================================
Install  5 Packages

Total size: 56 M
Total download size: 54 M
Installed size: 260 M
Downloading Packages:
[SKIPPED] edb-as18-server-client-18.7.0-1.el10.x86_64.rpm: Already downloaded
[SKIPPED] edb-as18-server-libs-18.7.0-1.el10.x86_64.rpm: Already downloaded
(3/5): barman-3.21.0-1.el10.x86_64.rpm                                                                                          345 kB/s | 244 kB     00:00
(4/5): edb-python312-3.12.16-2edb.el10.x86_64.rpm                                                                               5.3 MB/s |  17 MB     00:03
(5/5): edb-python312-barman-3.21.0-1.el10.x86_64.rpm                                                                            5.9 MB/s |  36 MB     00:06
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                           8.5 MB/s |  54 MB     00:06
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                        1/1
  Installing       : edb-as18-server-libs-18.7.0-1.el10.x86_64                                                                                              1/5
  Running scriptlet: edb-as18-server-libs-18.7.0-1.el10.x86_64                                                                                              1/5
  Installing       : edb-python312-3.12.16-2edb.el10.x86_64                                                                                                 2/5
  Installing       : edb-python312-barman-3.21.0-1.el10.x86_64                                                                                              3/5
  Running scriptlet: barman-3.21.0-1.el10.x86_64                                                                                                            4/5
  Installing       : barman-3.21.0-1.el10.x86_64                                                                                                            4/5
  Installing       : edb-as18-server-client-18.7.0-1.el10.x86_64                                                                                            5/5
  Running scriptlet: edb-as18-server-client-18.7.0-1.el10.x86_64                                                                                            5/5
Installed products updated.

Installed:
  barman-3.21.0-1.el10.x86_64                       edb-as18-server-client-18.7.0-1.el10.x86_64            edb-as18-server-libs-18.7.0-1.el10.x86_64
  edb-python312-3.12.16-2edb.el10.x86_64            edb-python312-barman-3.21.0-1.el10.x86_64

Complete!
3.21.0 Barman by EnterpriseDB (www.enterprisedb.com)
-rwxr-xr-x 1 root root 147168 Nov 10 01:00 /usr/edb/as18/bin/pg_basebackup
-rwxr-xr-x 1 root root 125296 Nov 10 01:00 /usr/edb/as18/bin/pg_combinebackup
-rwxr-xr-x 1 root root  92032 Nov 10 01:00 /usr/edb/as18/bin/pg_receivewal
# m h  dom mon dow   user     command
  * *    *   *   *   barman   [ -x /usr/bin/barman ] && /usr/bin/barman -q cron

[root@lin6 ~]#

If the client package has a different name in your repository, dnf search edb-as18 shows the available packages. The installation creates the OS user barman with the home directory /var/lib/barman, the main configuration file /etc/barman.conf, the directory /etc/barman.d for the server configurations and a cron job that runs barman cron every minute.

2.3 Store the passwords

Barman connects with libpq, so the passwords are stored in the .pgpass file of the barman user. Afterwards we test both connections:

# run as root on lin6
cat > /var/lib/barman/.pgpass <<'EOF'
lin8:5444:*:barman:changeme
lin8:5444:*:streaming_barman:changeme
EOF
chown barman:barman /var/lib/barman/.pgpass
chmod 600 /var/lib/barman/.pgpass
# test the regular and the replication connection
su - barman -c "/usr/edb/as18/bin/psql -h lin8 -p 5444 -U barman -d edb -c 'select version();'"
su - barman -c "/usr/edb/as18/bin/psql 'host=lin8 port=5444 user=streaming_barman replication=true' -c 'IDENTIFY_SYSTEM;'"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
cat > /var/lib/barman/.pgpass <<'EOF'
lin8:5444:*:barman:changeme
lin8:5444:*:streaming_barman:changeme
EOF
chown barman:barman /var/lib/barman/.pgpass
chmod 600 /var/lib/barman/.pgpass
# test the regular and the replication connection
su - barman -c "/usr/edb/as18/bin/psql -h lin8 -p 5444 -U barman -d edb -c 'select version();'"
su - barman -c "/usr/edb/as18/bin/psql 'host=lin8 port=5444 user=streaming_barman replication=true' -c 'IDENTIFY_SYSTEM;'"
                                                                    version
------------------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 18.7 (EnterpriseDB Advanced Server 18.7.0) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 14.3.1 20251022 (Red Hat 14.3.1-4), 64-bit
(1 row)

      systemid       | timeline |  xlogpos  | dbname
---------------------+----------+-----------+--------
 7711382709664784657 |        1 | 0/3626F00 |
(1 row)

[root@lin6 ~]#

2.4 Configure the EPAS server in Barman

Each Postgres server gets its own configuration file in /etc/barman.d. The section name (epas18) is the name we use in all Barman commands:

# run as root on lin6
cat > /etc/barman.d/epas18.conf <<'EOF'
[epas18]
description = "EPAS 18 Redwood cluster on lin8"
conninfo = host=lin8 port=5444 user=barman dbname=edb
streaming_conninfo = host=lin8 port=5444 user=streaming_barman
backup_method = postgres
streaming_archiver = on
slot_name = barman
create_slot = auto
path_prefix = /usr/edb/as18/bin
staging_path = /var/lib/barman/staging
staging_location = local
retention_policy = RECOVERY WINDOW OF 7 DAYS
EOF
mkdir -p /var/lib/barman/staging
chown barman:barman /var/lib/barman/staging
backup_method = postgresBase backups with pg_basebackup. Required for block-level incremental backups.
streaming_archiver = onWAL files are streamed with pg_receivewal instead of being shipped by an archive_command.
slot_name / create_slot = autoBarman creates and uses the replication slot barman, so the EPAS server keeps WAL files until Barman has received them.
path_prefixUse the EPAS 18 client binaries.
staging_path / staging_location = localDirectory on the Barman server where the backup chain is combined with pg_combinebackup during the restore of an incremental backup.
retention_policyKeep all backups and WAL files needed to recover to any point in time of the last 7 days.

Note: The slot keeps WAL files on the EPAS server as long as Barman has not received them. If the backup server is down for a long time, pg_wal on lin8 grows. Consider setting max_slot_wal_keep_size on the EPAS server and monitor the slot.

2.5 Start WAL streaming and check the configuration

barman cron creates the replication slot and starts receive-wal in the background (the cron job would do this within a minute as well). barman switch-wal forces a WAL switch on the EPAS server and waits until the WAL file has arrived in the Barman archive. Finally, barman check must report OK for all checks:

# run as root on lin6
su - barman -c "barman cron"
su - barman -c "barman switch-wal --force --archive epas18"
su - barman -c "barman check epas18"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
su - barman -c "barman cron"
su - barman -c "barman switch-wal --force --archive epas18"
su - barman -c "barman check epas18"
Starting WAL archiving for server epas18
The WAL file 000000010000000000000003 has been closed on server 'epas18'
Waiting for the WAL file 000000010000000000000003 from server 'epas18' (max: 30 seconds)
Processing xlog segments from streaming for epas18 (batch size: 1)
        000000010000000000000003
Server epas18:
        PostgreSQL: OK
        superuser or standard user with backup privileges: OK
        PostgreSQL streaming: OK
        wal_level: OK
        replication slot: OK
        directories: OK
        retention policy settings: OK
        backup maximum age: OK (no last_backup_maximum_age provided)
        backup minimum size: OK (0 B)
        wal maximum age: OK (no last_wal_maximum_age provided)
        wal size: OK (0 B)
        compression settings: OK
        failed backups: OK (there are 0 failed backups)
        minimum redundancy requirements: OK (have 0 non-incremental backups, expected at least 0)
        pg_basebackup: OK
        pg_basebackup compatible: OK
        pg_basebackup supports tablespaces mapping: OK
        systemid coherence: OK (no system Id stored on disk)
        pg_receivexlog: OK
        pg_receivexlog compatible: OK
        receive-wal running: OK
        archiver errors: OK
[root@lin6 ~]#

3. Full Backup

3.1 Create some test data

To verify the restores later, we create a small table and record in which phase each row was inserted. Thanks to the Redwood mode we can use Oracle data types:

# run as root on lin8
su - enterprisedb -c "psql -d edb" <<'EOF'
create table bkp_test (id integer generated always as identity, phase varchar2(30), created timestamp default clock_timestamp());
insert into bkp_test (phase) select 'before full backup' from generate_series(1, 1000);
EOF

3.2 Take the full backup

The option --wait makes Barman wait until all WAL files required to make the backup consistent have been archived:

# run as root on lin6
su - barman -c "barman backup epas18 --wait"
su - barman -c "barman list-backups epas18"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
su - barman -c "barman backup epas18 --wait"
su - barman -c "barman list-backups epas18"
Starting backup using postgres method for server epas18 in /var/lib/barman/epas18/base/20261124T091230
Backup start at LSN: 0/4047AE0 (000000010000000000000004, 00047AE0)
Starting backup copy via pg_basebackup for 20261124T091230
Copy done (time: 7 seconds)
Finalising the backup.
This is the first backup for server epas18
WAL segments preceding the current backup have been found:
        000000010000000000000003 from server epas18 has been removed
Backup size: 58.3 MiB
Backup end at LSN: 0/6000060 (000000010000000000000006, 00000060)
Backup completed (start time: 2026-11-24 09:12:30.377039, elapsed time: 8 seconds)
Waiting for the WAL file 000000010000000000000006 from server 'epas18'
Processing xlog segments from streaming for epas18 (batch size: 3)
        000000010000000000000004
        000000010000000000000005
        000000010000000000000006
epas18 20261124T091230 - F - Tue Nov 24 09:12:37 2026 - Size: 90.3 MiB - WAL Size: 0 B
[root@lin6 ~]#

The backup ID is a timestamp such as 20261124T091230. Instead of the ID you can use shortcuts like latest, oldest or latest-full in most Barman commands.

3.3 Inspect the backup

# run as root on lin6
su - barman -c "barman show-backup epas18 latest"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
su - barman -c "barman show-backup epas18 latest"
Backup 20261124T091230:
  Server Name            : epas18
  System Id              : 7711382709664784657
  Status                 : DONE
  PostgreSQL Version     : 180007
  PGDATA directory       : /var/lib/edb/as18/data
  Estimated Cluster Size : 58.6 MiB

  Server information:
    Checksums            : on
    WAL summarizer       : on

  Base backup information:
    Backup Method        : postgres
    Backup Type          : full
    Backup Size          : 58.3 MiB (90.3 MiB with WALs)
    WAL Size             : 32.0 MiB
    Timeline             : 1
    Begin WAL            : 000000010000000000000005
    End WAL              : 000000010000000000000006
    Number of WALs       : 2
    Begin time           : 2026-11-24 09:12:30.371778+01:00
    End time             : 2026-11-24 09:12:37.770082+01:00
    Copy time            : 7 seconds
    Estimated throughput : 7.9 MiB/s
    Begin Offset         : 40
    End Offset           : 96
    Begin LSN            : 0/5000028
    End LSN              : 0/6000060

  WAL information:
    Number of files      : 0
    Disk usage           : 0 B
    WAL rate             : 7142.83/hour
    Last available       : 000000010000000000000006

  Catalog information:
    Retention Policy     : VALID
    Previous Backup      : - (this is the oldest base backup)
    Next Backup          : - (this is the latest base backup)
[root@lin6 ~]#

Among other things, show-backup shows the backup method (postgres), the backup type (full), the size, the begin and end WAL and the timeline of the backup.

4. Incremental Backups

An incremental backup needs a parent backup taken with backup_method = postgres. The parent can be a full backup or another incremental backup, so we can build a chain: full → incremental 1 → incremental 2.

4.1 First incremental backup

# run as root on lin8
su - enterprisedb -c "psql -d edb -c \"insert into bkp_test (phase) select 'after full backup' from generate_series(1, 500);\""
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "psql -d edb -c \"insert into bkp_test (phase) select 'after full backup' from generate_series(1, 500);\""
INSERT 0 500
[root@lin8 ~]#


# run as root on lin6
su - barman -c "barman backup --incremental latest-full epas18 --wait"
Sample Output (click to expand):
[root@lin6 ~]#
# run as root on lin6
su - barman -c "barman backup --incremental latest-full epas18 --wait"
Starting backup using postgres method for server epas18 in /var/lib/barman/epas18/base/20261124T091746
Backup start at LSN: 0/701F2A0 (000000010000000000000007, 0001F2A0)
Starting backup copy via pg_basebackup for 20261124T091746
Copy done (time: less than one second)
Finalising the backup.
Backup size: 5.2 MiB
Backup end at LSN: 0/9000000 (000000010000000000000008, 00000000)
Backup completed (start time: 2026-11-24 09:17:46.532623, elapsed time: 1 second)
Waiting for the WAL file 000000010000000000000008 from server 'epas18'
Processing xlog segments from streaming for epas18 (batch size: 2)
        000000010000000000000007
        000000010000000000000008
[root@lin6 ~]#

4.2 Second incremental backup

This time the parent is the latest backup, i.e. the first incremental backup:

# run as root on lin8
su - enterprisedb -c "psql -d edb -c \"insert into bkp_test (phase) select 'after incremental 1' from generate_series(1, 200);\""

Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "psql -d edb -c \"insert into bkp_test (phase) select 'after incremental 1' from generate_series(1, 200);\""

INSERT 0 200
[root@lin8 ~]#


# run as root on lin6
su - barman -c "barman backup --incremental latest epas18 --wait"
Sample Output (click to expand):
[root@lin6 ~]#
# run as root on lin6
su - barman -c "barman backup --incremental latest epas18 --wait"
Starting backup using postgres method for server epas18 in /var/lib/barman/epas18/base/20261124T091958
Backup start at LSN: 0/902CD38 (000000010000000000000009, 0002CD38)
Starting backup copy via pg_basebackup for 20261124T091958
Copy done (time: 3 seconds)
Finalising the backup.
Backup size: 5.2 MiB
Backup end at LSN: 0/B000000 (00000001000000000000000A, 00000000)
Backup completed (start time: 2026-11-24 09:19:59.002741, elapsed time: 4 seconds)
Waiting for the WAL file 00000001000000000000000A from server 'epas18'
Processing xlog segments from streaming for epas18 (batch size: 1)
        00000001000000000000000A
[root@lin6 ~]#

4.3 Compare the backups

# run as root on lin6
su - barman -c "barman list-backups epas18"
su - barman -c "barman show-backup epas18 latest"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
su - barman -c "barman list-backups epas18"
su - barman -c "barman show-backup epas18 latest"
epas18 20261124T091958 - I - Tue Nov 24 09:20:02 2026 - Size: 21.2 MiB - WAL Size: 0 B
epas18 20261124T091746 - I - Tue Nov 24 09:17:47 2026 - Size: 21.2 MiB - WAL Size: 32.0 MiB
epas18 20261124T091230 - F - Tue Nov 24 09:12:37 2026 - Size: 90.3 MiB - WAL Size: 32.0 MiB
Backup 20261124T091958:
  Server Name            : epas18
  System Id              : 7711382709664784657
  Status                 : DONE
  PostgreSQL Version     : 180007
  PGDATA directory       : /var/lib/edb/as18/data
  Estimated Cluster Size : 58.7 MiB

  Server information:
    Checksums            : on
    WAL summarizer       : on

  Base backup information:
    Backup Method        : postgres
    Backup Type          : incremental
    Backup Size          : 5.2 MiB (21.2 MiB with WALs)
    WAL Size             : 16.0 MiB
    Resources saved      : 53.5 MiB (91.14%)
    Timeline             : 1
    Begin WAL            : 00000001000000000000000A
    End WAL              : 00000001000000000000000A
    Number of WALs       : 1
    Begin time           : 2026-11-24 09:19:58.996984+01:00
    End time             : 2026-11-24 09:20:02.630878+01:00
    Copy time            : 3 seconds
    Estimated throughput : 1.4 MiB/s
    Begin Offset         : 40
    End Offset           : 0
    Begin LSN            : 0/A000028
    End LSN              : 0/B000000

  WAL information:
    Number of files      : 0
    Disk usage           : 0 B
    Last available       : 00000001000000000000000A

  Catalog information:
    Retention Policy     : VALID
    Previous Backup      : 20261124T091746
    Next Backup          : - (this is the latest base backup)
    Root Backup          : 20261124T091230
    Parent Backup        : 20261124T091746
    Backup chain size    : 3
[root@lin6 ~]#

For an incremental backup show-backup reports the backup type incremental, the parent backup and an estimation of the resources saved compared to a full backup. Keep in mind that the backups of a chain depend on each other: if you delete a full backup, Barman deletes all incremental backups based on it as well, and barman keep can only be applied to full backups (it then also keeps the dependent incrementals).

5. Prepare the Restores

Never restore into the data directory of a running cluster. In this lab we restore into a new directory on lin8 and start the restored cluster on port 5446 next to the production cluster. In a real disaster you would stop the cluster and restore into its (empty) data directory instead.

5.1 SSH key from barman@lin6 to enterprisedb@lin8

Remote restores use SSH with public key authentication: Barman connects from lin6 as OS user barman to lin8 as enterprisedb.

The obvious tool would be ssh-copy-id, but it does not work here: the EPAS packages create the enterprisedb user without a password, so the account is locked for password logins. Instead, we create the key pair as barman and use root on lin8 to put the public key into enterprisedb’s authorized_keys. You will be asked once for the root password of lin8 (on my test VM: changeme).

# run as root on lin6

# 1. create the key pair for the barman user
su - barman -c "ssh-keygen -t ed25519 -N '' -f ~/.ssh/id_ed25519"

# 2. install the public key for enterprisedb on lin8 (via root on lin8)
cat /var/lib/barman/.ssh/id_ed25519.pub | ssh root@lin8 '
  install -d -m 700 -o enterprisedb -g enterprisedb ~enterprisedb/.ssh &&
  cat >> ~enterprisedb/.ssh/authorized_keys &&
  chown enterprisedb:enterprisedb ~enterprisedb/.ssh/authorized_keys &&
  chmod 600 ~enterprisedb/.ssh/authorized_keys &&
  restorecon -R ~enterprisedb/.ssh'

# 3. test: accepts lin8's host key and must print "lin8" without a password prompt
su - barman -c "ssh -o StrictHostKeyChecking=accept-new enterprisedb@lin8 hostname"

Notes:

  • ~enterprisedb is expanded on lin8, so the command works regardless of the user’s home directory (usually /var/lib/edb).
  • restorecon restores the SELinux labels – with wrong labels sshd ignores authorized_keys and falls back to asking for a password.
  • -o StrictHostKeyChecking=accept-new adds lin8 to barman’s known_hosts without a prompt. Without it, the first connection fails with “Host key verification failed”.
  • Alternatively you could set a password with passwd enterprisedb and use ssh-copy-id – not recommended, as it opens password logins for the database owner.

5.2 Create the target directory on lin8

Barman refuses to restore into a directory that is not empty, so we create a fresh one:

# run as root on lin8
mkdir -p /var/lib/edb/as18/restore
chown enterprisedb:enterprisedb /var/lib/edb/as18/restore
chmod 700 /var/lib/edb/as18/restore

6. Restore the Latest Incremental Backup

When restoring an incremental backup, Barman combines the full backup and all incremental backups of the chain with pg_combinebackup in the staging directory on lin6 (staging_location = local), copies the result with rsync to lin8 and adds the WAL files required for the recovery:

# run as root on lin6
su - barman -c "barman restore --remote-ssh-command 'ssh enterprisedb@lin8' epas18 latest /var/lib/edb/as18/restore"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
su - barman -c "barman restore --remote-ssh-command 'ssh enterprisedb@lin8' epas18 latest /var/lib/edb/as18/restore"
Starting remote restore for server epas18 using backup 20261124T091958
Destination directory: /var/lib/edb/as18/restore
Remote command: ssh enterprisedb@lin8
Copying the base backup.
Start combining backup via pg_combinebackup for backup 20261124T091958 on /var/lib/barman/staging/barman-combine5259/20261124T091958/data
End combining backup via pg_combinebackup for backup 20261124T091958
Copying required WAL segments.
Generating archive status files
Identify dangerous settings in destination directory.

Restore operation completed (start time: 2026-11-24 09:42:52.636255+01:00, elapsed time: 14 seconds)
Your PostgreSQL server has been successfully prepared for recovery!
[root@lin6 ~]#

Now we start the restored cluster on port 5446 and check the test table. We expect the rows of all three phases:

# run as root on lin8
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore -o '-p 5446' -l /var/lib/edb/as18/restore/startup.log start"
su - enterprisedb -c "psql -p 5446 -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore -o '-p 5446' -l /var/lib/edb/as18/restore/startup.log start"
su - enterprisedb -c "psql -p 5446 -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
waiting for server to start.... done
server started
        phase        | count
---------------------+-------
 before full backup  |  1000
 after full backup   |   500
 after incremental 1 |   200
(3 rows)

[root@lin8 ~]#

Stop the restored cluster and empty the target directory before the next test:

# run as root on lin8
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore stop"
rm -rf /var/lib/edb/as18/restore
mkdir -p /var/lib/edb/as18/restore
chown enterprisedb:enterprisedb /var/lib/edb/as18/restore
chmod 700 /var/lib/edb/as18/restore

7. Point-in-Time Recovery (PITR)

Now the classic scenario: someone drops a table by accident, and we want to recover the database to the point in time right before the drop.

7.1 Simulate the user error

We insert some more rows, note the current time and drop the table a few seconds later:

# run as root on lin8
su - enterprisedb -c "psql -d edb" <<'EOF'
insert into bkp_test (phase) select 'before drop' from generate_series(1, 100);
select clock_timestamp() as pitr_target;
select pg_sleep(5);
drop table bkp_test;
EOF
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "psql -d edb" <<'EOF'
insert into bkp_test (phase) select 'before drop' from generate_series(1, 100);
select clock_timestamp() as pitr_target;
select pg_sleep(5);
drop table bkp_test;
EOF
INSERT 0 100
           pitr_target
---------------------------------
 24-NOV-26 09:50:03.09303 +01:00
(1 row)

 pg_sleep
----------

(1 row)

DROP TABLE
[root@lin8 ~]#

Write down the timestamp returned by clock_timestamp(). Then we make sure the WAL file containing the DROP TABLE is complete and has arrived in the Barman archive:

# run as root on lin6
su - barman -c "barman switch-wal --force --archive epas18"

7.2 Restore to the point in time

With --target-time we specify the recovery target. Include the time zone, otherwise the time zone of the Barman server is used. Instead of a backup ID we use auto: Barman then selects the most recent backup that finished before the target time. --target-action promote opens the cluster for read/write access as soon as the target is reached.

# run as root on lin6
# replace the timestamp with the value from step 7.1
su - barman -c "barman restore --remote-ssh-command 'ssh enterprisedb@lin8' --target-time '2026-11-23 21:40:12+01' --target-action promote epas18 auto /var/lib/edb/as18/restore"
Sample Output (click to expand):
[root@lin6 ~]# # run as root on lin6
# replace the timestamp with the value from step 7.1
su - barman -c "barman restore --remote-ssh-command 'ssh enterprisedb@lin8' --target-time '2026-11-24 09:50:03+01' --target-action promote epas18 auto /var/lib/edb/as18/restore"
Starting remote restore for server epas18 using backup 20261124T091958
Destination directory: /var/lib/edb/as18/restore
Remote command: ssh enterprisedb@lin8
Doing PITR. Recovery target time: '2026-11-24 09:50:03+01:00'
Copying the base backup.
Start combining backup via pg_combinebackup for backup 20261124T091958 on /var/lib/barman/staging/barman-combine5510/20261124T091958/data
End combining backup via pg_combinebackup for backup 20261124T091958
Copying required WAL segments.
Generating recovery configuration
Identify dangerous settings in destination directory.

Restore operation completed (start time: 2026-11-24 09:52:42.639678+01:00, elapsed time: 12 seconds)
Your PostgreSQL server has been successfully prepared for recovery!
[root@lin6 ~]#

Tip: If you are not sure about the exact time, use --target-action pause. The cluster then stays in recovery at the target and you can check the data read-only before you finish the recovery with select pg_wal_replay_resume();. Besides a timestamp, Barman also supports a transaction ID (--target-xid), an LSN (--target-lsn) and named restore points (--target-name) created with pg_create_restore_point(), e.g. right before a risky deployment.

7.3 Start the cluster and verify the data

# run as root on lin8
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore -o '-p 5446' -l /var/lib/edb/as18/restore/startup.log start"
su - enterprisedb -c "psql -p 5446 -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore -o '-p 5446' -l /var/lib/edb/as18/restore/startup.log start"
su - enterprisedb -c "psql -p 5446 -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
waiting for server to start.... done
server started
        phase        | count
---------------------+-------
 before full backup  |  1000
 after full backup   |   500
 after incremental 1 |   200
(3 rows)

[root@lin8 ~]#

The table is back, including the 100 rows inserted shortly before the drop. Since the production cluster is still running, we do not need to switch to the restored cluster. We simply copy the table back with pg_dump and clean up afterwards:

# run as root on lin8
su - enterprisedb -c "pg_dump -p 5446 -d edb -t bkp_test | psql -d edb"
su - enterprisedb -c "psql -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore stop"
rm -rf /var/lib/edb/as18/restore
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c "pg_dump -p 5446 -d edb -t bkp_test | psql -d edb"
su - enterprisedb -c "psql -d edb -c \"select phase, count(*) from bkp_test group by phase order by min(id);\""
su - enterprisedb -c "pg_ctl -D /var/lib/edb/as18/restore stop"
rm -rf /var/lib/edb/as18/restore
SET
SET
SET
SET
SET
SET
SET
SET
 set_config
------------

(1 row)

SET
SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
ALTER TABLE
COPY 1700
 setval
--------
   1832
(1 row)

        phase        | count
---------------------+-------
 before full backup  |  1000
 after full backup   |   500
 after incremental 1 |   200
(3 rows)

waiting for server to shut down.... done
server stopped
[root@lin8 ~]#

8. Scheduling and Retention

The cron job installed with the package runs barman cron every minute. It keeps receive-wal running and applies the retention policy, but it does not take backups. A simple schedule with a weekly full backup and daily incremental backups looks like this:

# run as root on lin6
cat > /etc/cron.d/barman-backups <<'EOF'
# weekly full backup on Sunday, incremental backups Monday to Saturday
30 1 * * 0   barman /usr/bin/barman -q backup epas18
30 1 * * 1-6 barman /usr/bin/barman -q backup --incremental latest epas18
EOF

Every incremental backup in a chain has to be combined during a restore, so long chains make restores slower and depend on more backups. A full backup every week keeps the chains short. Backups and WAL files that are no longer needed for the 7-day recovery window are removed automatically by barman cron. For monitoring, barman check epas18 --nagios returns output in Nagios format.

Troubleshooting Common Issues

no pg_hba.conf entry for replication connectionAdd the host replication streaming_barman … line to pg_hba.conf on lin8 and reload the configuration (step 1.3).
barman check: receive-wal running: FAILED or replication slot: FAILEDRun barman cron as user barman and check the Barman log /var/log/barman/barman.log. The slot can also be created manually with barman receive-wal --create-slot epas18.
barman check: WAL archive: FAILEDNo WAL file has been archived yet. Run barman switch-wal --force --archive epas18.
Incremental backup fails because of WAL summarizationsummarize_wal must be on on the EPAS server before the parent backup is taken. Enable it (step 1.1) and take a new full backup.
Restore fails because of a missing staging path or pg_combinebackupCheck staging_path, staging_location and path_prefix in /etc/barman.d/epas18.conf and that the EPAS client package is installed.
Restore fails because the destination directory is not emptyBarman does not overwrite existing files. Empty or recreate the target directory (step 5.2).
PITR fails with recovery ended before configured recovery target was reachedThe WAL after the target time is not yet archived. Run barman switch-wal --force --archive epas18 and restore again.
ssh-copy-id: Host key verification failedThe barman user cannot answer the host key prompt. Connect once with -o StrictHostKeyChecking=accept-new (step 5.1).
enterprisedb@lin8: Permission denied (publickey,…,password)The enterprisedb user has no password, so ssh-copy-id cannot log in. Install the public key via root on lin8 (step 5.1).

Resources

Conclusion

With a dedicated Barman server our EPAS 18 Redwood cluster is now protected by streaming base backups and continuous WAL archiving. Here is a quick recap:

  • summarize_wal = on on the EPAS server enables native block-level incremental backups.
  • backup_method = postgres with streaming_archiver = on needs no SSH for backups and keeps the potential data loss close to zero.
  • barman backup --incremental builds chains of incremental backups on top of a full backup; Barman combines them with pg_combinebackup during the restore.
  • barman restore --target-time (or --target-xid, --target-lsn, --target-name) performs a point-in-time recovery, and auto selects the right backup.
  • Restoring into a separate directory on a different port is a safe way to test restores and to recover single objects without touching the production cluster.

Next Steps:

  • Test restores regularly, ideally automated on a separate test server.
  • Copy the backups to a second location, e.g. object storage with Barman’s cloud features or a geo-redundant Barman server.
  • Combine Barman with a high availability setup (EDB Failover Manager or Patroni) as described in the previous post.
  • Monitor Barman and the replication slot with Postgres Enterprise Manager (PEM) or your existing monitoring.
0