Files are 0 bytes and showing as local changes - Will Revert local changes cause me to lose other files?

I have device A and device B. Device A has a folder (main-folder) being synced which is send only on Device A. Device B is receiving the same folder from Device A, in receive only mode and ignores deletes on Device A.

Device A → Send Only → Device B receive only & ignore deletes

Once the sync is complete I delete some of the less important files from Device A to save space. So, over time Device B has accumulated a lot of files which are no longer present in Device A. I have 30+ GiB in Device A currently, but overtime Device B has accumulated 90+ GiB.

A few days back when I was syncing both devices and lost power, which ended up corrupting 4 files in Device B. After a restart, I saw that those 4 files have not properly synced and are 0 bytes and showing up as local changes. Now, syncthing is unable to sync/recevie those 4 files into Device B.

I attempted a filesystem scan and fix using chkdsk /f and it did not help. I attempted to delete those 4 files from Device B so that they would sync up again (might have been a bad idea?), but was having trouble finding them to delete them. So they do not really exist on disk.

Not sure how to proceed, so that those 4 files can be synced into Device B.

These 4 files show up as local changes on Syncthing in Device B. And it displays the button to “Revert local changes”, which when I click says,

Warning: The folder content on this device will be overwritten to become identical with other devices. Files newly added here will be deleted. Are you sure you want to continue?

I am concerned that clicking on yes to continue will delete more files on Device B other than just those 4 files having 0 bytes. Which means I will lose over 60 GiB on Device B. Will “Revert Local Changes” delete files other than those 4 files?

Yes, you will lose the 60GB.

That hurts. I certainly do not want to lose the other 60GB of files.

Is there any way I can reset just those 4 files so that they can get synced again?

Your screenshot shows four locally changed files. Those are the ones that would be reverted.

Your screenshot also shows that there should supposedly be 30.9 GiB but are currently 99 GiB, so we can assume that reverting local changes would remove 60 GiB of data.

I don’t know how that matches up, but you should figure it out.

Device A is my phone and Device B is my PC.

With the above mentioned setup, it performs a one-way sync from phone to my PC. Once it is synced I delete the files from my phone, since I keep running out of space on my Phone and need to recover some space.

Since, I have Ignore Deletes on the synced folder on my PC, it has more files than my phone, these files were all present earlier on my phone but were deleted later on phone after syncing to PC. That is the reason for the 60+ GiB present only on my Device B.

Is there any alternative to “Revert Local Changes”, which could help revert/reset just those 4 files so that they can get synced again?

With “ignore deletes” all bets are off here, I’m not sure how that will affect things. You can copy those files manually from somewhere maybe.

If you can wait a few hours, I’m going to replicate the same configuration in my test environment and see what actually happens what trying to revert the changes. Whatever happens though, I would strongly advice to simply make a backup of the folder on the PC before trying to proceed with anything that could potentially destroy any data.

Edit:

I have just tested this. I can say for sure that reverting local changes will delete everything and make the folder identical with the other device, regardless of ignoreDelete being enabled. Thus, you should definitely do a backup if you don’t want to lose the local files.

3 Likes

Thank you @tomasz86 for trying this out and letting me know.