Question about 'keep this number of backups' option

If i understand correctly the incremental backup creates a full backup at the beginning and then backup only changes from the previous backup. I have set 1 week for the option ‘keep this number of backups’. What does it mean? After seven days Duplicati will delete all backups, create again full backup and start creating incremental backups after that, and after seven day will repeat the process again?

Hi @Ivan. What this means is that data will recoverable for the last 7 days from the latest backup. Only the initial backup is a full and duplicati is smart enough to not backup files that have already been backed up. Basically it’s a first full and then delta-incremental forever.

So, if the first day Duplicati creates full backup and the rest 9 days creates incremental backups, then the backups that are from the four to the ten day including the full backup from the first day will be recoverable, and the backups from the second and the third day will not be recoverable. Correct?

Not quite. The first day backup will also not be restorable.

Remember, Duplicati chops your files up into small blocks (100KB by default) and stores those blocks along with a database of what blocks need to be re-assembled to restore what files. When you change a file, Duplicati stores the updated blocks and makes note that the unchanged blocks from the original backup are ALSO used by the 2nd backup.

When it comes time for the original version to be deleted, Duplicati will only delete the blocks NOT in use by a version that isn’t being deleted.

So in your example backups from days four to ten would be restorable but the backup from day one would NOT be because the blocks unique to that day’s versions of the files would have been deleted.

What happens with the backups from the second and the third day that are not recoverable? Are they been deleted?

If i want to recover the backup from the eight day how this will work? Will duplicati use (need) the backup files from the eight day and the full backup from the first day, or will use (need) the backup files from the fourth to eight day and the full backup from the first day?

Try not to think of full and incremental backups. Essentially every backup Duplicati makes is a full one, it just re-uses existing unchanged backup contents rather than re-uploading a block that already exists. And remember, we’re not talking about entire files here - we’re talking about blocks / chunks of files.

When the deletes happen, only blocks not in use by any backup version are deleted. So if you have a text file that you ADDED to (already existing content doesn’t change) daily for the last 10 days then no matter what day’s backup (aka version) you decide to restore, they’ll ALL use the same block that was created on day 1 (because that block hasn’t changed through all the versions).

If the day one backup version ages out and is flagged for deletion, then it will no longer appear as restorable but technically, NOTHING will be deleted from the backup because all the blocks created in the first backup are still in use by later (not yet deleted) backups.

Now if on day 11 you go and change the FIRST block of your file, then the “block 1” of that file from day 1 is no longer used in the day 11 backup. If your retention rule is to “keep 10 days of backups” then when the backup runs on day 12…nothing will happen to that day-1-block-1.

Even thought that individual block from day 1 is no longer needed to restore the day 11 backup, it IS still needed to restore days 2 - 10. So it won’t be until day 22 (11 days after the block stopped being needed for a restore) that it is actually deletable from the backup.

1 Like

So, if i understand correctly the backups that are not recoverable are not deleted, only if they contain files that are not needed for restoration are deleted?

Essentially yes, that’s it. So if you have a big file that was the same in days 1, 2, and 3 of your backups and day 1 “ages-out” then day 1 will disappear from the restore list, but nothing will actually be deleted from the destination because it still needs all that content in case you want to restore days 2 or 3.

It’s the references to “aged-out” backup versions that are deleted (so you can’t see them in the restore list anymore), but the actual file chunks (100KB blocks, by default) aren’t deleted until after they aren’t needed in ANY backup version.

If you’re interested in how the destination files change when a backup version is “aged-out” I can explain how that works as well, but I don’t want want to give you more info than you care about. :wink:

1 Like

Thanks, i have enough information to digest. And it is all new to me.

1 Like

Thanks @JonMikelV, you explained that much better than I did :slight_smile:

1 Like