Pruning

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.

There are three main resources, on the Director side, where automatic pruning is configured in Bacula:

  • the Job{} resource

  • the Client{} resource

  • the Pool{} resource

For a Job{} resource, there are three directives used to configure automatic prune:

  • Prune Jobs = <yes|no> (default is no)

  • Prune Files = <yes|no> (default is no)

  • Prune Volumes = <yes|no> (default is no)

For Client{} and Job{} resources, there is only one directive used to configure automatic prune:

  • AutoPrune = <yes|no> (default is yes)

If automatic pruning is disabled in these resources (AutoPrune = no) and the directives Prune Jobs, Prune Files or Prune Volumes are set to yes in a Job{} resource, it will override the settings in the Client{} resource (for Jobs and Files) and in the Pool{} resource (for Volumes).

Read more:

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.

  • If a single Pool{} or Client{} resource has an Autoprune = yes set, automatic pruning is activated.

See also

Go back to:

Go to:

Go back to the Storage Space Management chapter.

Go back to the main Bacula Enterprise Management page.