DietPi-Sync doesn't delete files on destination folder Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
mafioso12dk
Posts: 8
Joined: Wed Oct 07, 2020 9:56 am

DietPi-Sync doesn't delete files on destination folder

Post by mafioso12dk »

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
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPi-Sync doesn't delete files on destination folder

Post by MichaIng »

Many thanks for your report. Indeed there is a bug, introduced with v6.33. I just fixed it: https://github.com/MichaIng/DietPi/comm ... fL139-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 :?.

Changelog: https://github.com/MichaIng/DietPi/comm ... f5d854fb89
mafioso12dk
Posts: 8
Joined: Wed Oct 07, 2020 9:56 am

Re: DietPi-Sync doesn't delete files on destination folder

Post by mafioso12dk »

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?
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPi-Sync doesn't delete files on destination folder

Post by MichaIng »

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.
mafioso12dk
Posts: 8
Joined: Wed Oct 07, 2020 9:56 am

Re: DietPi-Sync doesn't delete files on destination folder

Post by mafioso12dk »

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

Code: Select all

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
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPi-Sync doesn't delete files on destination folder

Post by MichaIng »

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 ... nc#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.
mafioso12dk
Posts: 8
Joined: Wed Oct 07, 2020 9:56 am

Re: DietPi-Sync doesn't delete files on destination folder

Post by mafioso12dk »

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
User avatar
MichaIng
Site Admin
Posts: 2422
Joined: Sat Nov 18, 2017 6:21 pm

Re: DietPi-Sync doesn't delete files on destination folder

Post by MichaIng »

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