Backup Restoration
pgsmart backup restore [Flags]
Flags:
-a, --agent=<agent>
=> Alias, hostname, or IP of the server where the desired PgSmart Agent is installed.-b, --backup=<value>
=> Backup identifier. [default: All]-h, --help
=> Help-j, --job=<value>
=> Backup/restore job identifier.-o, --only-info
=> Displays only backup site information. Used with the --quiet option.-p, --no-page-info
=> Indicates not to paginate backup site information. Used with the --quiet option.-q, --quiet
=> Non-interactive execution for backup operations (exec|info|restore). Used with the --site and --agent options.-s, --site=<value>
=> Backup site name. [default: All]--disable-archive
=> Disables WAL archiving for the restored backup. Used with the --quiet option.--restore-path=<value>
=> Path where the backup will be restored. [default: Backup site's data directory] Used with the --quiet option.--restore-type=(delta|force)
=> Overwrite mode if files already exist in the restore location. Used with the --quiet option.- delta: Overwrite using checksums.
- force: Fully overwrite the directory.
- Instructions
- Video
pgsmart backup restore -a <agent> --site <backup-site-name> --backup <backup-name> --quiet --restore-type=[delta|force]

pgsmart backup restore
- Instructions
- Video
-
Select the desired PgSmart Agent (or Register a new Agent).
-
PgSmart will validate if there is a registered backup site. If not, it will allow registering a new site.
-
Select the backup site.
3.1. PgSmart will list available backups to select the desired one (highlighting the most recent).
PgSmart will validate the site, checking aspects such as whether the database service is running, for example. However, it will not block the operation if any irregularity is found (informational only). Restoration does not depend on the site status.
-
Select the desired backup.
noteBackup IDs are generated by pgBackRest and consist of:
- =A prefix representing the timestamp (YYMMDD-HHMMSS) of when the backup was created.
- A suffix "F", "I" or "D", indicating full, incremental, or differential backup.
- For incremental/differential backups, the full backup ID precedes the current backup ID.
Example:
- (full) 20230520-130807F
- (incr) 20230520-130807F_20230520-130816I
- (diff) 20230520-130807F_20230523-180002D
- (full) 20230523-192605F (Most recent backup)
-
After selecting the backup, confirm if you want to use the default
PGDATA
path from the selected backup site.noteIf restoring to the same directory configured for backups, PgSmart will check for running services and request confirmation to stop them, as the restore requires all services offline.
-
PgSmart will check if files already exist in the target directory. If so, you must specify the overwrite action.
Possible actions:
- Checksum-based overwrite: only files with differences are replaced, resulting in a directory identical to the backup.
- Fully overwrite: the entire directory is deleted and recreated from the backup.
Both methods lead to the same final result; however, checksum overwrite is faster as it handles only changed files.
-
Confirm whether WAL archiving should be disabled.
-
Confirm the execution of the restore process.
Figure 1 - Backup Restoration
If the restoration directory is different from the one configured for backups, PgSmart will validate the directory. If it does not exist, confirmation for creation will be required. If creation is declined, PgSmart will cancel the operation and return to the main menu.
-
Since WAL archiving is already enabled (the backup site is active), restoring a backup into a new site will restore the PostgreSQL configuration parameters as well.
-
To avoid transaction logs from being written into the wrong environment (e.g., restoring in a testing environment while connected to production), WAL archiving should be disabled. This ensures that transaction logs are only managed locally in the instance's directory, avoiding risks.
The restoration can be verified directly in the directory:
cd /var/lib/pgsql/15/datann
To confirm the restored configuration parameters:
cat postgresql.auto.conf