How to prevent deleting files from remote

I want to make a backup task which will save all backup files even if they are deleting from source.

I have tried to do this with retention-policy, keep-time, keep-versions, but no luck. If I delete some files from source and run another backup, then Duplicati deletes it’s from the remote, every time.

Is it possible with Duplicati? What option should I use?

Sorry for my poor English.

Welcome to the forum!

If you keep all backup versions, then deleted items will be restorable.

If you do NOT keep all backup versions, but instead are limiting retention, deleted items MAY be restorable. It depends on a backup version still existing for the time when the files were present on your system.

Does this help? Let me know if you still have questions.

Thanks for answer.

I have just backed up two files, then deleted one of them, then backed up again, then restore the entire backup. So, only one file has been restored.

Why was second file deleted from the backup? How I can prevent this?

root@server:/tmp/test# ls -lh
итого 23M
-rw-rwx--- 1 user user 9,6M авг.  12  2019 file_1
-rw-rwx--- 1 user user  13M сент.  5  2019 file_2
root@server:/tmp/test# duplicati-cli backup webdav://$AUTH_USERNAME:$AUTH_PASSWORD@webdav.cloud.mail.ru:443/test/ /tmp/test/ --use-ssl=true --retention-policy=7D:0s 
Backup started at 15.05.2020 19:24:41
Checking remote backup ...
  Listing remote folder ...
Scanning local files ...
  3 files need to be examined (22,41 МБ)
  Uploading file (22,33 МБ) ...
  Uploading file (1,17 КБ) ...
  0 files need to be examined (0 байт)
  Uploading file (16,28 КБ) ...
Checking remote backup ...
  Listing remote folder ...
Verifying remote backup ...
Remote backup verification completed
  Downloading file (1,17 КБ) ...
  Downloading file (16,28 КБ) ...
  Downloading file (22,33 МБ) ...
  Duration of backup: 00:00:49
  Remote files: 3
  Remote size: 22,34 МБ
  Total remote quota: 0 байт
  Available remote quota: 0 байт
  Files added: 2
  Files deleted: 0
  Files changed: 0
  Data uploaded: 22,34 МБ
  Data downloaded: 22,34 МБ
Backup completed successfully!
root@server:/tmp/test# rm /tmp/test/file_2 
root@server:/tmp/test# duplicati-cli backup webdav://$AUTH_USERNAME:$AUTH_PASSWORD@webdav.cloud.mail.ru:443/test/ /tmp/test/ --use-ssl=true --retention-policy=7D:0s 
Backup started at 15.05.2020 19:26:08
Checking remote backup ...
  Listing remote folder ...
Scanning local files ...
  2 files need to be examined (9,56 МБ)
  Uploading file (829 байт) ...
  Uploading file (1,04 КБ) ...
  Uploading file (877 байт) ...
Checking remote backup ...
  Listing remote folder ...
Verifying remote backup ...
Remote backup verification completed
  Downloading file (1,04 КБ) ...
  Downloading file (877 байт) ...
  Downloading file (829 байт) ...
  0 files need to be examined (0 байт)
  Duration of backup: 00:00:03
  Remote files: 6
  Remote size: 22,35 МБ
  Total remote quota: 0 байт
  Available remote quota: 0 байт
  Files added: 0
  Files deleted: 1
  Files changed: 0
  Data uploaded: 2,71 КБ
  Data downloaded: 2,71 КБ
Backup completed successfully!
root@server:/tmp/test# duplicati-cli find webdav://$AUTH_USERNAME:$AUTH_PASSWORD@webdav.cloud.mail.ru:443/test/ "*" --use-ssl
Listing contents 0 (15.05.2020 19:26:08):
/tmp/test/ 
/tmp/test/file_1 (9,56 МБ)
root@server:/tmp/test# duplicati-cli restore webdav://$AUTH_USERNAME:$AUTH_PASSWORD@webdav.cloud.mail.ru:443/test/ --use-ssl=true 
Restore started at 15.05.2020 19:26:45
Checking remote backup ...
  Listing remote folder ...
Checking existing target files ...
  1 files need to be restored (9,56 МБ)
  Downloading file (22,33 МБ) ...
  0 files need to be restored (0 байт)
  Downloading file (22,33 МБ) ...
  Downloading file (829 байт) ...
Verifying restored files ...
Restore completed without errors but no files were restored
Restored 0 (0 байт) files to original path
Duration of restore: 00:01:01
root@server:/tmp/test# ls -lh
итого 9,6M
-rw-rwx--- 1 user user 9,6M авг.  12  2019 file_1
root@server:/tmp/test#

You are not specifying which backup snapshot version to restore, so it restores the most recent one. The most recent one only had a single file because that’s what the source looked like at the time the backup was made.

Specify --version=1 to tell it to restore the earlier snapshot version. (version 0 is the most recent, version 1 is one older, etc)

1 Like

Although versions are more obvious in the GUI restore dropdown where you pick one, CLI can use

The FIND command

If no <filename> is specified, a list of all available backups is shown.

whereas your current line is using

<filename> can contain * and ? as wildcards.

as seen in your post

duplicati-cli find webdav://$AUTH_USERNAME:$AUTH_PASSWORD@webdav.cloud.mail.ru:443/test/ “*” --use-ssl

1 Like

Oh thank you guys. It’s all about --version / --all-versions options. So now I can see all files in the backup.

Well, next time I will read the docs more accurate.