DietPi-Sync doesn't delete files on destination folder

Hi. I have 2 HDDs connected to Raspberry Pi 4b through USB ports. Disk 1 is mounted in /mnt/share, Disk 2 is mounted in /mnt/backup. Everything works just fine, disks mount automatically even after reboot and after cold start, but i have problem with dietpi-sync function. I want to have exact copy of share disk on backup disk so I set Delete Mode and Daily Sync to ON. I created for tests New Folder in /mnt/backup location and tried to run rsync and the tool didn’t delete this folder. I was trying multiple times and everytime effect was the same.

Then I ran this command in terminal:
sudo rsync -hvrPt --delete /mnt/share/ /mnt/backup

and everything synced just fine
Anyone knows what’s the matter

Thanks in advance

Many thanks for your report. Indeed there is a bug, introduced with v6.33. I just fixed it: https://github.com/MichaIng/DietPi/commit/e5ed1dbc4f65c2b3aff2508bd1291cf5dedfe04e#diff-5af048f2cc1f2f943579889d33d8636a0e0cb490245a76709721ca1ed8747a9fL139-R139
Manually adjust that one highlighted line. “rsync_option” variable is not used anymore and we forgot to adjust this one case where it is used. I wonder that our code quality scan didn’t throw an error, as actually it does when a variable is assigned that is never used :thinking:.

Changelog: https://github.com/MichaIng/DietPi/commit/ad07a309e4301c7038ec1da1e26d23f5d854fb89

Thanks for help, now “delete” option works but I think it deletes to much now. It started to delete *.db and *.tmp files although they exist on the source disk. Maybe it doesn’t see hidden files on source disk?

rsync includes hidden files and directories within the source directory. Please recheck if you added excludes (/boot/dietpi/.dietpi-sync_inc_exc), since those are removed from the target as well. The script does a dry run first and allows you to review the log file, so you could review this and assure that really existing and non-excluded files are removed.

I don’t have any excludes defined in the file. After running the command I wrote above:

sudo rsync -hvrPt --delete /mnt/share/ /mnt/backup

the Used amount of space is exactly the same on both disk, but after using dietpi-sync the Used amount of space on the backup disk is lower and it deletes files that certainly are on the share disk.

It happend after the 6.33 update. Before everything was fine

Hmm, we use and used: -aHP4 --info=name0 --info=progress2 --delete --delete-excluded
I see we have a default exclude list (we did before, this has not changed): https://github.com/MichaIng/DietPi/blob/master/dietpi/dietpi-sync#L57-L65
This explains the .tmp files and you said .db files? At least the old-style (decentralised) Windows image thumbs.db files are excluded as well. Does this explain all your missing files? Else please list examples that you did not expect, so I can test this as well.

So when this files are excluded by default so everything seems to work fine. I just didn’t know about it and thought that every single file should be copied. Thank you very much for your help

Probably we should make this transparent, i.e. creating a default exclusion file but allowing to view and edit it.