Accepting shared folder to folder which has been shared before can lead to data loss!

I’m not sure if I should report this as a bug. But at least I want to warn people.

I recently had the following situation:

  • I had a syncthing folder on my phone. But I deleted it from the list of synced folders. Or maybe I uninstalled syncthing. I don’t really remember. The result was a folder named ‘Sharedwithpc’ on my phone with the “.stfolder” marker still present inside it. But not (currently) shared.
  • At some point I moved this folder to the sdcard on m phone. I don’t know if this has any effect on the final result, but I mention it nonetheless.
  • I decided to re-share the folder from my pc with my phone, so I added my phone to the list of devices on my pc.
  • Then on my phone I clicked on the popup that the pc wanted to share a folder. And then when setting up the local folder I selected the existing ‘Sharedwithpc’ folder on my phone’s sd card. Big mistake!!!
  • Syncthing then decided that all files which were present on the pc but not on the phone were deleted on the phone and proceeded to also delete them on my pc. I only noticed this at the end of the day when I had already done lots of work on the pc and the chance of recovering anything was gone.

This cost me about 250 photographs which were new-ish and hence not yet backed up anywhere. (syncthing deleted 1500 files but I had abckup for most of them luckily).

Imo syncthing should never consider missing files in a newly attached folder (even if it already has a .stfolder marker) as ‘deleted’, but always treat them as ‘missing’ and sync them in instead of deleting them on the other side.

Syncthing does precisely this. I’m not saying what happened to you didn’t happen, obviously, but it’s certainly not intended to – and doesn’t, under usual circumstances. Funky stuff seems to happen with some regularity when phones and photos are involved, though. ;/

1 Like

Hm, strange. Because it did happen :frowning: My daugther is very sad, because all the photo’s she made at a concert are gone.

On my pc I have a very recent syncthing version. But I’m not sure about the phone. Maybe that one was older.

Also, syncthing told me that on the phone it had created a ‘send only’ folder because android wouldn’t let it write to the sd card. Maybe in that situation it still goes wrong?

I think on linux, where there’s no OS trash can on delete (I don’t actually know if there is on windows/mac) , trash-can-versioning should be the default on new folder creation, instead of no-versioning. That would have saved me here.

A send only folder, if you press “Override changes”, will do that, yes.

2 Likes

I’d also add that there is no confirmation pop-up in the Android app too, so one misclick and the data may be gone forever. Personally, I’d not use Send/Receive Only folder on Android unless you’re going to only use the Web GUI (which does have confirmation pop-ups for dangerous actions, and also the “override” and “reverse changes” buttons are hidden before you unfold the folder info which isn’t the case in the app).

1 Like

Maybe I clicked that accidentally…

Rather dangerous that ‘Override Changes’ makes remote changes. I can’t remember if I clicked that, but I probably interpreted it as ‘override the local’ changes.

And I did not plan on making it a send-only folder. Syncthing did that silently because apperently it couldn’t get permissions to write on the SD card? I did give it write permissions but anyway.

There need to be some more scare popups in this scenario imho.

I understand that the files have been deleted by syncthing on your PC? A technical savvy person (you?) may be able to recover (some of) the files, especially if it is photos.

Key would be to turn of the PC ASAP, as every running minute increases the chance of the OS overwriting them.

Not sure if the 250 pics are worth it, but I have recovered photos from PCs where the owner had brutally installed a new OS over it.

A linux Live OS and testdisk would probably be enough (presuming you’re not on Mac)

Which Android version is it specifically? Two-way SD card sync works only in Android 4.3 and older, and Android 11 and newer. The versions in between that will only allow you to sync folders there as Send Only (unless you run Syncthing as root). Also, the Camera folder specifically, which is added to Syncthing on Android on the first start automatically, is set to “Send Only” by default, which may be a surprise if you’ve only used Syncthing on the desktop previously.

Yeah, this is a known issue. Someone just needs to implement the same kind of pop-ups as the Web GUI already uses.

Thanks for the hint. But alas, already tried all undeletion tricks I know about. And there were zero recoverable files. I guess because it’s

a) an SSD, I think the block deletion scheme those use make extundelete not really work

b) it’s on an encrypted partition (which definitely screws up extundelete) and

c) I only found out after a day, when the laptop was used for all kinds of other things.

This is what happened, because it’s Android 10. There’s no indication this happens, though. I just accepted the incoming share request and pointed it to the existing folder on the SD card. ANd there’s no mention of it creating a Send-only folder (that I’ve noticed, that is)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.