What happens when a user deletes a file from the source directory?

Hello! I’m new to Duplicati and am trying to learn as much as I can about how it works before I start using it. I’m curious how Duplicati behaves when a user deletes a file from the source directory. What impact does this have on the destination directory and a possible future restore operation?

For example, let’s say that Duplicati is set to perform a daily backup on a source directory containing photos and a user accidentally deletes a photo from that directory unknowingly. I’m curious:

  1. What does Duplicati do during the next backup cycle and how is the remote backup content affected?
  2. How does this behavior differ with different retention strategy settings for Duplicati?
  3. How does this impact a possible future restore action?

Context: This scenario describes my intended use case - family photos that a user may accidentally delete and not realize until days have past.

Thank you!

It depends on what retention strategy you’ve set up.

  • When your strategy is to keep all versions of your backup history you can easily restore the deleted files even weeks, months or years after you’ve deleted them.
  • When you’ve set up duplicati to keep a fixed number of backups the oldest ones get deleted every time a new backup is stored. Let’s say you store a backup of your photos directory every day and you’ve configured duplicati to always keep 10 versions. In that case (assuming you’re storing the new backup every day and none is skipped) after ten days the oldest backup will get deleted. So if you realize that someone deleted a file eleven days ago in this scenario it’s too late to restore it.
  • Instead of defining a fixed number of backups you can also set a period of time after which old versions of your backup will be deleted.
  • And finally there is the possibility to set up a smart retention period. This allows you to define a ruleset in which a decreasing number of backup versions is stored the older they become. For example when you’re storing one backup a day you can decide to keep every version of this for one month. After this you could keep one copy per week for the next six months and after this one version for each month for the next three years.
2 Likes

To add to the excellent answer from @dpr, a source file block is retained until no backup version needs it, meaning retention has deleted them all. At that time, the source block becomes wasted space to compact.

The backup process explained
How the backup process works (deeper, but basically any backup version only lists the files present then)
Future restore would involve looking at versions before the deletion in order to restore the now-deleted file.

1 Like

Thank you both for your answers.

1 Like