Automatic deletion of old snapshots

Having a mechanism to schedule snapshot creation is great, having to manually clean them up not so much.

I suggest implementing a configurable cron job that cleans up old snapshots.

I can think of two approaches:

  • A simple version would just delete snapshots of a specific volume that are older than a configurable number of days.
  • A more sophisticated version would allow to “thin” out snapshots, for example having daily snapshots of the last week, weekly snaphots of the last month and monthly snapshots of the last year.

@Tom thanks for providing really good ideas. I am definitely up for making snapshot management easier and easier. It’s such an important feature after all.

Currently, when you schedule snapshots for a share, you can specify a maximum count. So older snapshots beyond this count do get deleted. Similarly, thinning out can be done by having separate scheduling jobs that take snapshots on a weekly, monthly and yearly basis. I know we are lagging on documentation right now and that will change soon, but have you tried using the scheduling feature?

@suman Thank you for your answer. I am currently playing with all the features and as snapshots are currently not visible in the UI, I decided to wait for the next release until I use the scheduling.

The thining out by using different cron jobs is a very good idea I didn’t think of. How is the automatic deletion implemented? Do you use the name (prefix and timestamp) to identify to which cron job a snapshot belongs or some other identification?