Issue with backup cleanup when snapshots are present

Hi.

Once more time wanted to thank you for the amazing Urbackup solution.

Issue I’m facing is the following: whenever backup storage resides on system with snapshots and such snapshot exists, Urbackup will clean backups till minimal allowed number of image of file backups reached.

Let’s review that on example:

  1. I have ZFS with size of disk of 100M.
  2. I’ve set free space threshold to 95%.
  3. I create snapshot of the storage. In my case it’s for using send/receive functionality and sync backups to remote host.
  4. Under low disk space conditions Urbackup starts to delete backups in order to free some space.
  5. All deleted backups are COWed to last snapshot and in fact, space is not freed. It will be freed, when that snapshot will be deleted.
  6. Urbackup will continue this behaviour till minimal number of image or file backups reached for each client.

This might destroy important historical backups without actually freeing space AND urbackup will eventually fail to perform backup, as disk will be 100% occupied.

It’s not directly issue of Urbackup, but I think there could be an improvement to prevent this from happening. Because if unseen, can lead to a catastrophic backup erase. I was witnessing this and was able to quickly add another disk to Pool, so Urbackup stopped deleting backups.

Suggestion: Define 2 more thresholds in configurations:

  1. Amount of backups (in size or % from storage) that are allowed to be deleted per day/hour/run.

For example: 50Mb of backups are allowed to be deleted per day. This way, delete process will be stretched in time and either will be noticed by urbackup administrators or snapshot rotation will happen and space will be freed. Default: no limit (as now)

  1. Threshold at which urbackup will stop making new backups in % or in MB.

For example: When 99% of storage space is occupied and attempt to free more space is not helping (either due to all backups were deleted or above limit has been reached), urbackup will not perform new backups. They might actually fail with error on the server side, so needed emails are sent.

Default: no limit (as now)

At the moment I’m not sure how to tackle this issue otherwise with multiple clients and inability to set minimal number of backups to adequate numbers, as apparently I want to have as much backups per client as space allows me to have.

Will be happy to hear suggestions on this matter.