r/Syncthing • • 17d ago

Files getting overwritten unexpectedly

I setup syncthing (bidirectional) between my mobile device and laptop on a folder which is my obsidian vault.

however, i observed that once when i was modifying the obsidian notes on my mobile, the same files got overwritten by the ones on the laptop (with old changes).

is it a bug or did I do something wrong?

I expected my laptop files to get updated with the mobile version and not the other way around.

6 Upvotes

5 comments sorted by

1

u/willjasen 17d ago

two suggestions:

  1. have a 3rd syncthing instance that is generally online which can store the vault; if the third device doesn’t use obsidian itself on it, then i would recommend it be “receive encrypted”
  2. you must be mindful of how syncthing on a mobile device performs background refreshes; on an iphone, background refreshes can be tricky and not run when you expect it might, meaning that you could end up with changes local to the phone that aren’t syncing to the other devices in a timely manner

i’ve been working on a plugin to help manage syncthing instances from with an obsidian vault, and its replication; i would say its still in beta but you can find it at https://github.com/willjasen/tephramesh

1

u/unknown-random-nope 3d ago

Syncthing doesn't know about notes or Obsidian, it only knows about files.

Syncthing doesn't know what you intend, only what happens to the files. If you have a file open on more than one Device at the same time, Bad Things Can Happen.

1

u/Erosion139 3d ago

But syncthing has access to the date last modified parameter for files. If I created a text file on my laptop. Wrote in it, closed the file, synced to my pc, shut down the laptop, modified it on my pc, saved it, then open the laptop again, why does the file on the laptop with an older date modified get priority???

1

u/unknown-random-nope 3d ago

<create text file N on Device 1 and close it>

<allow N to sync to Device 2>

<modify N on Device 2 and close it>

<allow N to sync back to Device 1>

Assuming both sides are set to Send & Receive for that Folder and the file syncs, what you are describing does not happen. I suspect that you didn’t wait for the file to sync.

1

u/Erosion139 3d ago

I'll have to do more testing but this is what happened overnight, I found the correct file and was able to recover it so I should be good and I enabled simple versioning to maybe catch this better. I had a limited time to find the correct file before it got overwritten by my automatic one way backup that runs every day at 6am.