Over the course of time when using BART, the number of backups can grow significantly. This ultimately leads to a large consumption of disk space unless an administrator periodically performs the process of deleting the oldest backups that are no longer needed.This process of determining when a backup is old enough to be deleted and then actually deleting such backups can be accomplished and eventually automated with the following basic steps:
1. Determine and set a retention policy in the BART configuration file. A retention policy is a rule that determines when a backup is considered obsolete. The retention policy can be applied globally to all servers (see Section 4.1), but each server can override the global retention policy with its own (see Section 4.2.5).
2. Use the MANAGE subcommand to categorize and manage backups according to the retention policy. Such functionality includes determining which active backups should be considered obsolete at this current point in time, selecting backups to keep indefinitely, and physically deleting obsolete backups. When an obsolete backup is deleted, its backup taken with the BACKUP subcommand along with that backup’s archived WAL files are deleted.
3. Once the retention policies have been determined and verified, you can create a cron job to periodically run the MANAGE subcommand to evaluate the backups and then list and/or delete the obsolete backups.There is a difference on how retention policy management applies to incremental backups as compared to full backups.See Section 5.2.5 on how retention policy management applied to full backups affects incremental backups.The following sections describe how retention policy management generally applies to backups, and its specific usage and effect on full backups:
• Note: The examples shown in the previously listed sections were generated with BART version 1.1. The retention policy management process is the same for the current BART version, however the displayed output of the SHOW-BACKUPS and SHOW-SERVERS subcommands now include a few additional fields that do not influence the retention policy.