Overview

When working with database backups you can build up a huge amount of backup data. It is crucial having lots of backups to be able to restore a know working state, and the more backups you have the better the time resolution to get back to the exact same state you need.

This strategy can lead you to a lot of backups in no time. Having a lot of backups from 3 years ago is not as important as having a lot of backups from yesterday. If you agree with the last statement and you are using Backup and Migrate, then the Backup and Migrate Prune module will help you.

Backup and Migrate Prune is a module that helps you delete old and unimportant backups from the past. The module will allow you to:

  • Keep all backups from the last 24h.
  • Keep only one backup per day for backups older than 24h for backups from the last 7 days.
  • Keep only one backup per week for backups older than 7 days for backups from the last month.
  • Keep only one backup per month for backups older than 1 month for backups from the last year.
  • Keep only one backup per year for backups older than 1 year.

This module lets you select the dates of the backups you want to keep. Doing this you will free disk/storage space while maintainig the vast majority of the relevant information.

Usage

Install and enable the module as usual.

Follow these steps:

  • Head to admin/config/system/backup_migrate/prune (assuming you already have a configured Backup and Migrate as your backup solution).
  • Add a Gardener. A gardener is just a process that will delete some of your backups according to his/her settings.
  • Select the day, week and month you want to keep.
  • Save your gardener.

That's all! You have already set up your gardener, who is now in charge to keep the number of backups under control. You can now manually prune your destination (by clicking the prune link) or wait until cron does it automatically for you.