public inbox for [email protected]  
help / color / mirror / Atom feed
Associating a pg_basebackup .backup file with it's saveset?
2+ messages / 2 participants
[nested] [flat]

* Associating a pg_basebackup .backup file with it's saveset?
@ 2025-08-23 13:56 Ron Johnson <[email protected]>
  2025-08-25 07:27 ` Re: Associating a pg_basebackup .backup file with it's saveset? Laurenz Albe <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Ron Johnson @ 2025-08-23 13:56 UTC (permalink / raw)
  To: Pgsql-admin <[email protected]>

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 /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/

$ 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

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Associating a pg_basebackup .backup file with it's saveset?
  2025-08-23 13:56 Associating a pg_basebackup .backup file with it's saveset? Ron Johnson <[email protected]>
@ 2025-08-25 07:27 ` Laurenz Albe <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2025-08-25 07:27 UTC (permalink / raw)
  To: Ron Johnson <[email protected]>; Pgsql-admin <[email protected]>

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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-08-25 07:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-23 13:56 Associating a pg_basebackup .backup file with it's saveset? Ron Johnson <[email protected]>
2025-08-25 07:27 ` Laurenz Albe <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox