Обсуждение: Associating a pg_basebackup .backup file with it's saveset?
PG 16.10
(I'd rather use PgBackRest, but can't due to the fact that the immutable filesystem where we must store backup files doesn't support links. 😞)
Thus, I'm archiving WAL files and taking basebackups.
At some point, when I'm ready to delete the oldest basebackup directory, I'll also of course need to run "pg_archivecleanup /Database/backups/wals mumble".
The .backup file is not in the pg_wal.tar file, so how do I know which .backup file to use?
archive_command = '/usr/local/bin/postgres/wal_archive.sh "%p" "%f"'
$ cd /Database/backups/wals
$ dir *backup
-rw------- 1 postgres postgres 341 2025-08-23 08:42:39 000000010000000200000023.00000028.backup
-rw------- 1 postgres postgres 341 2025-08-23 09:24:48 000000010000000200000035.00000028.backup
$ dir *backup
-rw------- 1 postgres postgres 341 2025-08-23 08:42:39 000000010000000200000023.00000028.backup
-rw------- 1 postgres postgres 341 2025-08-23 09:24:48 000000010000000200000035.00000028.backup
$ dir /Database/backups/basebackup/
total 0
drwxr-xr-x 2 postgres postgres 113 2025-08-23 08:42:41 2025-08-23_08-42-36_full/
drwxr-xr-x 2 postgres postgres 113 2025-08-23 09:24:50 2025-08-23_09-24-43_full/
total 0
drwxr-xr-x 2 postgres postgres 113 2025-08-23 08:42:41 2025-08-23_08-42-36_full/
drwxr-xr-x 2 postgres postgres 113 2025-08-23 09:24:50 2025-08-23_09-24-43_full/
$ dir /Database/backups/basebackup/2025-08-23_09-24-43_full/
total 152896
-rw------- 1 postgres postgres 612541 2025-08-23 09:24:48 backup_manifest
-rw------- 1 postgres postgres 153057906 2025-08-23 09:24:48 base.tar.zst
-rw------- 1 postgres postgres 2847732 2025-08-23 09:24:48 pg_wal.tar.xz
-rw-r--r-- 1 postgres postgres 37864 2025-08-23 09:24:50 schemata.tar.xz
total 152896
-rw------- 1 postgres postgres 612541 2025-08-23 09:24:48 backup_manifest
-rw------- 1 postgres postgres 153057906 2025-08-23 09:24:48 base.tar.zst
-rw------- 1 postgres postgres 2847732 2025-08-23 09:24:48 pg_wal.tar.xz
-rw-r--r-- 1 postgres postgres 37864 2025-08-23 09:24:50 schemata.tar.xz
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
On Sat, 2025-08-23 at 09:56 -0400, Ron Johnson wrote: > I'm archiving WAL files and taking basebackups. > > At some point, when I'm ready to delete the oldest basebackup directory, > I'll also of course need to run "pg_archivecleanup /Database/backups/wals mumble". > > The .backup file is not in the pg_wal.tar file, so how do I know which .backup file to use? One thing you can use is the "backup_label" file in the base backup. Its first line will look like START WAL LOCATION: 0/B000028 (file 00000001000000000000000B) You would have to extract the WAL file name from the text. Yours, Laurenz Albe