PG_BACKUPCLUSTER(1)
π PG_BACKUPCLUSTER(1) π
okay bestie, this is pg_backupcluster β a Debian PostgreSQL infrastructure babe. she's a little front-end and she's about to make your whole backup situation iconic. pull up a chair π«Ά
β¨ NAME β¨
pg_backupcluster β a simple pg_basebackup and pg_dump front-end. that's it, that's the girl.
πΈ SYNOPSIS πΈ
pg_backupcluster [options] version cluster action
π¦ DESCRIPTION π¦
so basically pg_backupcluster gives you the simplest possible interface for making PostgreSQL cluster backups, and she does it using pg_basebackup(1) and pg_dump(1). no cap. π
and because systemd integration needs to be easy too, there's an alternate syntax that also works:
pg_basebackup version-cluster action
literally both are fine, she just wants you to win. β¨
π ACTIONS π
createdirectoryβ makes/var/backups/postgresqland/var/backups/postgresql/version-cluster. this one's the one you run as root to set up the dirs backups need. all the other actions will also try to create the directories if they're missing, but bestie they can obviously only do that if they're running as root. after that step they switch over to the cluster owner. π«‘basebackupβ backup time, usingpg_basebackup(1). the basebackup it spits out contains the WAL files you need to run recovery on startup. slay.dumpβ backup viapg_dump(1). global objects (users, tablespaces) get dumped usingpg_dumpall(1) --globals-only. individual databases get dumped into PostgreSQL's custom format.expirebasebackups Nβ removes all but the lastNbasebackups. bye girl πexpiredumps Nβ removes all but the lastNdumps.deletebrokenβ removes all broken backups. the cleanup we love to see.receivewalβ launchespg_receivewal. WAL files are gzip-compressed in PG 10+.compresswalβ compresses WAL files in the archive.archivecleanupβ removes obsolete WAL files from the archive usingpg_archivecleanup(1).listβ shows dumps, basebackups, and WAL, with size. the receipts. π§Ύ
β¨ OPTIONS β¨
-c,--checkpoint=spread|fastβ passed straight topg_basebackup. default isspread.-k,--keep-on-errorβ keeps the broken backup directory when there's an error. by default, backups get deleted on error. you can clean up broken backups later with thedeletebrokenaction. π-v,--verboseβ verbose output, even when you're not running on a terminal. she's chatty and she owns it.-Z level,--compress=levelβ passed topg_dump,pg_basebackupandpg_receivewal. default ispg_dump's default compression,gzipforpg_basebackup, and5forpg_receivewal.
π FILES π
/var/backups/postgresqlβ default root directory for cluster backup directories./var/backups/postgresql/version-clusterβ default directory for cluster backups./var/backups/postgresql/version-cluster/timestamp.basebackupβ the backup frompg_backupcluster ... basebackup. here's what's inside her:config.tar.gzβ tarball of the cluster configuration directory (postgresql.conf,pg_hba.conf, ...) in/etc/postgresql.tablespace.tar.gz,pg_wal.tar.gz,backup_manifestβ tablespace and WAL tarballs and backup info written bypg_basebackup.statusβ completion timestamp of the backup run.
/var/backups/postgresql/version-cluster/timestamp.dumpβ the backup frompg_backupcluster ... dump. contents:config.tar.gzβ tarball of the cluster configuration directory (postgresql.conf,pg_hba.conf, ...) in/etc/postgresql.createcluster.optsβ options (encoding, locale, data checksums) to be passed topg_createclusterfor restoring this cluster.globals.sqlβ global objects (roles, tablespaces) frompg_dumpall --globals-only.databases.sqlβ SQL commands to create databases and restore database-level options.database.dumpβ database dumps frompg_dump --format=custom.statusβ completion timestamp of the backup run.
/var/backups/postgresql/version-cluster/walβ WAL files frompg_receivewal.
π CAVEATS π
okay listen, for dump-style backups, not all properties of the original cluster are preserved. important. keep reading:
- In PostgreSQL 10 and earlier,
ALTER ROLE ... IN DATABASEis not supported. - Not all
initdboptions are carried over. currently supported are--encoding,--lc-collate,--lc-collate, and-k --data-checksums.
β οΈ the earliest PostgreSQL version supported for dumps is9.3. for basebackups, the earliest supported version is9.1.receivewal(and hence archive recovery) are supported in9.5and later. don't try it on your ancient fossil, bestie π
π SEE ALSO π
pg_restorecluster(1), pg_dump(1), pg_dumpall(1), pg_basebackup(1), pg_receivewal(1), pg_archivecleanup(1).
π AUTHOR π
Christoph Berg <myon@debian.org> β the icon, the legend. π«Ά
and that's the whole page, bestie!! this babe ships in Debian, dated 2026-07-28, and she's forever our PG_BACKUPCLUSTER(1). go make some backups, you're doing amazing sweetie πβ¨π
π¦ where this page comes from
- ubuntu stonking: postgresql-common 293ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms