Backup retention problem

I am using smart backup retention and taking backups daily. I can see that the backup for the 5th and 3rd was deleted! I checked the logs and it seems like due to a slight difference in backup time, causes these days’ backups to be deleted.

What is the best way to avoid this?

I have a similar issue with another backup profile where I take an hourly backup. The retention rules for that is 1D:U,1W:1D,4W:1W,12M:1M. I face the same issue in that backup profile as well. What is the best way to make sure at least one daily backup is available for the current week?

There are a few posts around here that mention the “smart retention” not being quite as smart as some might hope. I seem to recall a thread around here that came to (what seemed to be) a decent work-around but I’m not finding it atm. Forum search for backup retention yields some reading material, maybe you can find something suitable in on of those threads.

Personally, I just set it to “Keep a specific number of backups” with a value of 30 or more. I have separate jobs for each day so that’s 30 weeks (more than half a year of backups for that day) and there are still another 4 days in the week that get backed up. For myself that’s plenty enough coverage but it may not be sufficient for others.

1 Like

The problem is that Duplicati is very strict about the time ranges. You have specified that for the first week you only want 1 backup per day. If two adjacent backups are slightly less than 24 hours apart, one will be up for deletion.

It looks like you are scheduling one backup per day. Maybe the best solution is for you to just keep all backups for the first week before you start pruning. You could change your retention policy to this:

1W:U,4W:1W,12M:1M
1 Like

Assuming that these are scheduled by Duplicati, I’m surprised that the variation gets beyond seconds, however even seconds can cause issues, because 1D is 24 hours or 1440 minutes or 86400 seconds.

Instead of allowing one per day, use smaller (less documented) hours (h) minutes (m) and seconds (s).
For example instead of using 1W:1D, use 1W:23h to withstand up to an hour variation without problem.
Smart retention is equivalent to 1W:1D,4W:1W,12M:1M BTW.

If you mean calendar week starting at the first moment of whatever day your week starts at (Sunday?), that’s going to be hard. There is no calendar. You should have lots of backups for previous seven days.

If the problem is that some older calendar weeks have no backups, you can trim back your 1W interval, potentially having two in a calendar week, but it sounds like occasional double is fine while none is not.

1 Like