For this procedure, we will need one new server. The backup server will remain pg-backup, but we need a target server for the restore. This server will be named pg-clone. Make sure to have the password for the postgres system user on this server. As usual, our database will be located at /db/pgdata:
- On the pg-backup server as the barman user, execute the following command for direct SSH access to pg-clone as the postgres user:
ssh-copy-id postgres@pg-clone
- Ensure that the target restore directory is empty on pg-clone with this command executed as the postgres user:
rm -Rf /db/pgdata
- Transmit the backup to pg-clone by running this command as barman on the pg-backup server:
barman recover --remote-ssh-command "ssh ...