Database Backup Management
This guide describes how to manage online database backups for the SUSE Multi-Linux Manager server using mgradm.
The backup system is based on PostgreSQL continuous archiving Write-Ahead Logging (WAL), similarly like smdba in previous versions.
|
1. Overview
Continuous archiving reduces the risk of data loss by constantly backing up the transaction logs (WAL) to a dedicated volume.
The backup system utilizes a dedicated Podman volume named var-pgsql-walbackup to store:
-
A base backup (a full snapshot of the database).
-
WAL segments (incremental changes since the last base backup).
|
Point-in-time recovery is currently not supported by Only full recovery is supported by |
2. Prerequisites
-
mgradmtool installed on the host. -
SUSE Multi-Linux Manager server running in a Podman environment.
3. Enabling backups
To enable continuous archiving, run the following command:
mgradm backup db enable
This command:
-
Verifies that the backup is not already enabled.
-
Configures PostgreSQL (
postgresql.conf) to enablearchive_modeand sets thearchive_command. -
Configures the
var-pgsql-walbackupvolume for the database service. -
Restarts the database service to apply changes.
-
Performs an initial base backup inside the container.
If the backup is already configured but you need to re-initialize it, use the --force flag.
4. Checking backup status
You can verify the current state of the database backup system at any time:
mgradm backup db status
The command will report one of the following statuses:
-
enabled: Backup is correctly configured and active.
-
disabled: Continuous archiving is explicitly turned off.
-
misconfigured: There is a discrepancy between the configuration and the runtime state (for example, missing volume, incorrect archive command).
5. Maintaining backups (rebasing)
Over time, the number of WAL segments can grow significantly, consuming disk space and increasing restoration time. It is recommended to periodically "rebase" the backup by creating a new base backup and starting a new WAL chain.
mgradm backup db rebase
This command creates a fresh full snapshot of the database without requiring a service restart.
|
Regularly rebase your database backups using command |
6. Restoring from backup
Restoring from a backup is a destructive operation that replaces the current database data with the content of the backup.
mgradm backup db restore
The restoration process:
-
Stops the database service.
-
Clears the current database data directory.
-
Extracts the base backup from the backup volume.
-
Configures PostgreSQL for recovery.
-
Starts the database service.
-
Replays the WAL segments to bring the database to the latest possible state.
The command will wait until the database has fully recovered and is ready to accept connections.
|
Ensure you have a recent base backup and all necessary WAL segments in the |
7. Disabling backups
To turn off continuous archiving:
mgradm backup db disable
By default, this command disables archiving in the configuration and restarts the database but preserves the backup volume.
To also remove the backup volume and all stored backups, use:
mgradm backup db disable --purge-volume
|
Regularly test your restore procedures to verify data integrity and ensure you are prepared for a recovery. |
8. External documentation
For more information on PostgreSQL, see PostgreSQL 16: Continuous Archiving and Point-in-Time Recovery (PITR)