Pruning

CommunityEnterprise

As Bacula writes files to a Volume, it keeps a list of files, jobs, and volumes in a database called the Catalog. Among other things, the database helps Bacula to decide which files to back up in an incremental or differential backup, and helps you locate files on past backups when you want to restore something. However, the Catalog will grow larger and larger as time goes on, and eventually it can become unacceptably large.

Bacula ’s process for removing entries from the Catalog is called Pruning.

The default is Automatic Pruning, which means that once a Job record reaches a certain age (e.g. 30 days old) and a pruning occurs, it will be removed from the Catalog. Note that Job records that are required for current restore won’t be removed automatically, and File records are needed for VirtualFull and Accurate backups. Once a job has been pruned, you can still restore it from the backup Volume, provided that the Volume has not been recycled, but one additional step is required: scanning the volume with bscan. The alternative to Automatic Pruning is Manual Pruning, in which you explicitly tell Bacula to erase the catalog entries for a volume. You’d usually do this when you want to reuse a Bacula volume, because there’s no point in keeping a list of files that USED TO BE on a volume. Or, if the catalog is starting to get too big, you could prune the oldest jobs to save space. Manual pruning is done with the prune command.

For many deployments, Automatic Pruning is usually fine and does not interfere with normal operations. However, with larger deployments with several millions of files, pruning can take a long time, and can possibly hold up other Jobs.

Additionally, there may be race conditions when Volume pruning is done while backup Jobs are running. This is especially true in large environments, and even more so if Volume truncation is being performed.

The recommended solution for medium and large environment (more than 50 Clients and millions of files) is to disable automatic pruning everywhere, and perform pruning at a quiet time outside of the backup window. The customer has to create a specific Director’s Storage resource pointing to a free SD device used in the Autochanger (or all the devices). The requirement is to have this specific device pointing back to Autochanger it belongs to by using an Autochanger directive.

Configure automatic pruning in the Director’s Job{}, Client{}, and Pool{} resources.

Resource

Directives and defaults

Effect

Job{}

Prune Jobs, Prune Files, and Prune Volumes each accept yes or no and default to no.

Set a directive to yes to enable the corresponding type of pruning at the end of the Job.

Client{}

AutoPrune = <yes|no> (default yes)

At the end of a Job, Bacula applies File Retention and Job Retention to the corresponding Catalog records. For each directive, Bacula uses the value configured in the Pool resource if set there. Otherwise, it uses the Client’s value.

Pool{}

AutoPrune = <yes|no> (default yes)

Bacula applies Volume Retention when a Job needs a Volume and the Pool has no appendable Volumes.

If automatic pruning is disabled in a Client{} or Pool{} resource (AutoPrune = no), a Job{} resource can override that setting. Set Prune Jobs or Prune Files to yes to override the Client setting for Jobs or Files, respectively. Set Prune Volumes = yes to override the Pool setting for Volumes.

The Director{} resource also has a global AutoPrune setting. Setting it to no disables automatic pruning across all resources.

Notes

  • When a volume is pruned, all the Jobs and files associated with this volume are pruned as well. When a Job is pruned, all the files associated with the Job are also pruned. If you have your Job and file retentions greater than your Volume retention, your Jobs and files will be pruned as soon as the Volumes they are stored on is pruned.

  • The pruning process is closely related to retention periods configuration. Bacula will only prune Jobs, files or Volumes whose their retention time has expired. There is one exception: a Volume can be pruned and reused if there are no more Jobs and files associated to it in the Catalog, even if the volume retention time has not expired. This is usually desirable, provided job retention times match actual requirements. Please check Schedules and Retentions section of this guide for retention period recommendations.

Read more:

See also

Previous articles:

Next articles:

Go back to: Storage Space Management.