"almost" lost all files in my distributed pc network after usb disk umount

Hi all, I just “almost” lost all files in my distributed pc network after usb disk umount. One of my pc with syncthing has /mnt/folder1/syncthing folder which is situated on my usb drive. Today it was unmounted or connection with usb drive was lost. Then all my other pc-s got ~/syncthing folder empty. Ok, I copied all my files few days ago, so I lost only few files, but still need someone please to check how this might even happen? Is it possible to turn off automatically my shared folder on pc with usb drive unmounted so that it will not affect other pc-s ?

All my pc-s are debian-based. syncthing v0.14.18, Linux (32 bit) Please tell me what else do you need to advise. Thanks ahead.

It depends on where the mount point and the syncthing folder root is. We do some safeguards around it, but yeah, if your paths are in some unfortunate setup where the mount is not at the root of the syncthing folder, it can happen.

Any example of “some safeguards” and “unfortunate setup” please?

the mount is not at the root of the syncthing folder

More detailed explanation here please?

We have a .stfolder file at the root of each syncthing folder. If that goes missing, we assume a mount failure, on all other circumstances we’ll assume user intentions, as there is no trivial way to differentiate between a mount failure and a user deleting the folder

Created .stfolder file (empty) in my syncthing folder root using nano /mnt/wd/syncthing/.stfolder (saved without any content) Will see how it will work. Thank you.

It gets created by syncthing when needed. If anything you potentially made it worse.


Does Syncthing warn/inform about this in any way (i.e. docs or UI)?

Sure, it should be clear that it is a bad idea to have a mount within a synced directory, but as is apparent it isn’t to everyone. UI is probably impossible, as a general warning is way too verbose and checking whether there is mounts below a folder root path at creation not (easily) possible on all platforms. And in the docs I struggle to find an appropriate place to mention this. Adding yet another FAQ entry feels like abusing that as a catch-all category.

The folder gets stopped with a folder marker missing error.

Sorry I should have written what I mean by “this”: Someone creating a folder at e.g. /mnt/syncthing/ and then mounting his usb stick at /mnt/syncthing/usb/. In that scenario the .stfolder protection (expectedly) does not work. While it should be obvious, it probably isn’t.

This is not something we can detect, in general. (If we could, we wouldn’t really need the .stfolder.)

Well, I’m not one of those who can understand it deeper from developer’s point of view, but as a regular user (ok, maybe more or less experienced user), I’d love to have some option in gui like “do not delete all files in my distributed pc network if the content disappears on this instance”…

That’s basically the same as saying “if another device deletes some files, don’t delete them from this device”. There’s already an advanced option for that, “ignoreDeletes”.


This is one of those cases when you are happy to have your files on BTRFS with hourly snapshots :stuck_out_tongue:

1 Like

Found and enabled “ignoreDelete” (not “ignoreDeletes”) option, thx.

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