Home / GitHub Page

Can I sync data folder directly?

#1

Hi, people.

I plan to use Syncthing for synchronization as WebDAV seems to have some issues according to your topics.

But is there some technical reason why I should replicate sync folder configured for filesystem replication and not directly the folder with sqlite database and resources subfolder?

I understand that Syncthing synchronization is not instant and is running in some batches depending on filesystem changes detection (could be an issue on Android) but within few minutes I would expect all data are in sync.
sqlite updates are atomic and using transactions, therefore syncing live sqlite database file should not be an issue.

I don’t expect I will update notes on more clients within a short timeframe.

Or did I miss something important and to replicate only configured sync folder is the only way how to not corrupt data?

Will the usage of sync folder assure integrity in case of modifications from more clients?

Many thanks.

#2

Hello.

As far as I know (and of course I might be wrong), what you describe could work, but is unsupported.
I guess if you synced your complete Profile folder with everything in it and made absolutely sure there never are two instances of the app running before all previous changes have finished syncing, it could work.

But I’d bet you’ll end up breaking your setup rather sooner than later. If you start the app on two machines and each of them updates the .sqlite DB, your sync will suddenly have a conflicting set of updates, and you won’t ‘merge’ or sync the DB state - you’ll just have to discard at least one set of changes. in the best case.

That’s why we have the sync functionality. It takes care of all of that.
And remember, you don’t have to use WebDAV. There even is a ‘sync to folder’ feature, in case you can place it in a shared network location.

1 Like
#3

Hi, @zblesk.

Thanks for reply. Will rather use WebDAV on backend server to save space (not use filesystem sync folder).

#4

Please be aware that using network shares is dangerous. You could lose all data!!!

If Joplin encountered an empty path (which would happen in case of a network error or when it can’t reach the smb share for some other reason), it would delete all your local notes and they are gone. The filesystem sync is for local filesystems only. You can always rsync them to a network share or use a sync client. Just make sure that Joplin does not encounter an empty target path by accident. As I said, all your notes will be gone.

#5

I guess network shares should never be used with two-way sync in general, whether it’s Joplin, rsync, or any such tool.

The behaviour of exposing an empty dir when the share is not connected seems buggy to me. They should change the permissions on the dir and deny access or maybe remove the dir from the system. But just making it look like it’s there but empty is weird.

#6

Yes, it’s weird.
I have to make a snapshots of my server’s data pretty often.
If I will lose copy on my phone or PC, no big deal, will resync them again…