Edit: Thanks for all the suggestions. I'm going to try sticking with syncthing and try the fork of the UI and see if that keeps everything working.
--
I want to sync files between my linux PC and Android phones (mostly for Obsidian notes).
Can anyone recommend a good real-time sync?
I've been trying syncthing, but despite turning off battery optimization for the app, it rarely sees the phone as connected. I don't want to have to remember to check syncthing every time I edit a note.
I use resilio for syncing between PCs but it looks like it has a high battery usage on the phone, as if it is frequently polling for changes.
I use FolderSync for occasional scheduled syncs (e.g. updating my MP3s from the server to my phone), but a scheduled sync either is frequent enough to affect battery or it risks sync conflicts.
Cloud services such as OneDrive, Dropbox and Google Drive don't show up as big battery drains, so I assume that they use change notifications from the OS instead.
Are there any real-time 2-way sync apps for phone that don't have big battery drain and are not for cloud providers?
Do you use it on a phone too? I did find it tricky to set up (more options than I really need, and the phone app settings don't really work unless you select "Web UI", which is really strange), but I didn't mind the setup if I could then leave it alone and it works. Ideally I want to set this up on other family phones, so I can update notes and they appear everywhere.
I prefer Syncthing-fork for some more straightforward configuration. Mainly the three button options equating to "follow the run conditions, damnit", "run damnit", and "stop damnit"
I have a different app for photos, but SyncThing on my phone, and on my desktop, and again on one of my home servers, do most of the download and data syncing.
Occasionally I'll have to manually run SyncThing; I'm not certain that Android is reliably starting it after reboots, but for the most part it just does it's thing really reliably. There is a lag; it can take a few minutes for changes to sync - it's not immediate. For me, this isn't a problem, and I'd rather that than a battery suck, so I haven't messed with it.
Yeah, phone to laptop, and I recently synced all backups and files from an old phone to a new one, too. Once you have the computer setup, you can basically connect phones by reading its QR code.
If the official Syncthing Android app is giving you a hard time, maybe try Syncthing-fork? IIRC that's only the daemon and web GUI wrapped as an app. But I've used the main app only for the past few years.
NP! It's a great app, the dev updates it really frequently and I've never had any functional issue with it. I keep meaning to drop onto their git issues board and make a couple of small quality of life suggestions for the UI/UX as I use it dozens of times per day for work (there are some processes that currently take 5 clicks/per that could be reduced to 1 or 2 max) but that is a very small and nice problem to have.
Oh yeah sorry, I misunderstood. I think what you're looking for is local (network) versioning which I've had trouble finding in the past as well. I had hoped SyncThing would do it but it doesn't. Versioning is something a service like git does perfectly (i.e. notifies of and/or resolves conflicts in text files on the fly, seamlessly). When I was doing a lot of writing from different devices I set up a private repo on Github (and later Gitlab) and got my text editor to auto-sync-on-save to the repo (from any device) and it worked great. There are very likely self-hosted solutions that wouldn't rely on the cloud for that, but for me it worked fine as private repos because nobody but me would ever see those drafts (in a perfect world... we all know microsoft has almost certainly trained their shitty A.I. on my terrible writing versions over those years on Github because they own that platform).
I know there are ways to get Git working locally, probably for this purpose, but I don't know of any simple ones to suggest.
Interesting, I'd not heard of that. But does it auto-sync files? It mentions the clipboard, sharing links and browsing remote directories, but I don't see a file sync mentioned.
I'd like to use resilio, I even bought a license to support it as I use it for all my pc syncing. But it's currently showing 41% battery use for today on my phone for 2 minutes screen time 11.5 hours background.
Lenny Voyager shows 7% for 1.5 hour screen time. So something is not good with the phone app. Maybe the Android battery info display is misleading somehow (it confuses me because it shows a percentage of the time-interval you're viewing, not a percentage of the total battery drain(.
That's a good call out. My user case allows me to terminate the phone app after it syncs, and battery doesn't seem to be hit hard even if I forget. But it's important to look at, and it might not work for you.
I've been using syncthing for a while now, on different devices, and the only unreliability I've run into is with android killing syncthing to save battery life, which is kinda hilarious, considering all the vendor- and google-provided crap they happily waste battery on (I don't use it, but for what I've heard iOS is even worse in this regard).
Specifically, I have a samsung tablet where, no matter how much I tinkered with system settings, synchthing would only run if I manually launched the app or while the tablet was charging (BTW I still use that same tablet, but it now runs LineageOS and syncthing works flawlessly).
All this is to say, you should probably look into system settings and research ways to convince your OS to do what it's supposed to rather than tinkering with syncthing itself.
Looks like you already settled on this, but I'm doing exactly this (syncing obsidian, as well as photos/videos from camera reel), to desktop and NAS, using syncthing-fork. Let me know if you want some pointers.
I tend to just use FolderSync myself. To avoid battery issues, I have a schedule for most folders; but my DCIM/Pictures folders sync immediately upon changes.
I then have a widget on my homepage that triggers a 'sync all'. Anytime I need files synced immediately, it's easy enough to click that button.
If you don't mind going full back-to-basics, you can do this with standard command-line tools and no cloud server. Contrary to popular wisdom, a server is not necessary to sync files between a computer and a mobile device.
I use ssh and unison over wifi hotspot, no cable required. Works fine though it does require a button to be pressed. It doesn't sync constantly in the background. Personally, after many years of doing that, I decided that it was an anti-feature.
If you're using Obsidian for free then maybe try the built-in link which you'll find in the built-in options I think. It's a cost option but cheap. I think it eliminates the problems I'm having (below). I'm stubborn.
I'm not having problem with Syncthing, bar dealing with the stupid attempts to deal with deleted files that Android leaves laying around. I have .stignore files with .trashed-* and .trash/ entries on the Linux machine. Still having problems with _ed directories though and Syncthing conflict files when the sync isn't fast enough when I switch between the two.
Sometimes it takes Syncthing a while to work out the best route between the two nodes. Sometimes days. It used to send my packets to the internet before letting them back into the local network. Eventually it found a more direct route between them. I'm not sure but I think it has something to do with local IPv6; I'm talking out of my ass though.
I'm not affiliated to Syncthing or Obsidian besides being a happy user.
I have decent battery life on my Pixel 7 Pro. I have the respect battery save setting on so syncing stops at 20% or so I think.