this post was submitted on 22 Sep 2024
28 points (91.2% liked)

Selfhosted

39313 readers
370 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

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?

top 47 comments
sorted by: hot top controversial new old
[–] halm@leminal.space 32 points 2 days ago (1 children)

I'd really recommend giving Syncthing a second chance, twist a few knobs in the settings until it works. I've used it for years with barely a hitch.

[–] bandwidthcrisis@lemmy.world 4 points 2 days ago (4 children)

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.

[–] BearOfaTime@lemm.ee 7 points 2 days ago (2 children)

I keep multiple phones in sync, with hundreds of gigs synced every day.

[–] peregus@lemmy.world 1 points 2 days ago (1 children)

Have you found a way to get rid of the notification and keep Syncthing running in background?

[–] jws_shadotak@sh.itjust.works 4 points 2 days ago (1 children)

Just hide it in your OS notification settings

[–] peregus@lemmy.world 1 points 2 days ago (2 children)

But in this way I don't get any notification if something goes wrong

[–] jws_shadotak@sh.itjust.works 4 points 1 day ago (1 children)

I think any issues would show in "other"

[–] peregus@lemmy.world 1 points 1 day ago

Daaaaamn, was that so easy to just disable "Syncthing active"?
Let's try! Thanks

[–] prenatal_confusion@feddit.org 2 points 2 days ago (1 children)

For me that can be more specific. If I select the offending notification (either in the settings for notifications history or directly in the notification area) I can disable that specific type of notification. For instance deals from Amazon or eBay or something like connection established from tailscale.

[–] peregus@lemmy.world 1 points 2 days ago (1 children)

Are you sure that there are different type of notification for Syncthing? Have you disable the persistent one and still received a failed sync one (or something else)?

Tbh no I am not sure for synching. But I thought it was the case there as well.

[–] bandwidthcrisis@lemmy.world 1 points 2 days ago

Good to know. If I can get it working reliably, it will be worth sticking with. Someone suggested it might just not be auto-starting on reboots. I'm trying the fork of the UI on f-droid to see if it helps.

[–] sunstoned@lemmus.org 5 points 2 days ago (1 children)

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"

[–] bandwidthcrisis@lemmy.world 2 points 2 days ago

Thanks. I'm giving that a try!

[–] sxan@midwest.social 4 points 2 days ago (1 children)

It's the main way I sync my phone.

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.

[–] bandwidthcrisis@lemmy.world 1 points 2 days ago (2 children)

I could live with a few minutes, but it's showig as offline for days. Maybe it is failing after a reboot. At least that would be a known situation to watch for.

In my experience syncthing is always a bit like that using the default discovery settings.

I use a hub & spoke set up now. Instead of A, B, and C all connecting to each other directly, they only connect to D. I also input the address for D specifically instead of using discovery servers.

With this set up I've never had any drama.

[–] sxan@midwest.social 1 points 2 days ago

Honestly, I think Android is fucked for debugging stuff like this. I installed a program on mine and my wife's phones - different makes & models - and configured them exactly the same, including the app settings in the OS. Mine works perfectly and barely shows up in battery use, near the bottom. Her's drains her battery even when she's not using it, regularly running at 50% of total battery consumption.

With Android YMMV is the rule, rather than the exception. There's just too many variables.

[–] halm@leminal.space 3 points 2 days ago (2 children)

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.

[–] bandwidthcrisis@lemmy.world 3 points 2 days ago (1 children)

I have the phones connected, but the app just decides to disconnect and stay that way until I check it. I'll give that fork a try, thanks!

[–] halm@leminal.space 2 points 2 days ago

Perhaps your phone has extra aggressive battery saving settings that kill the background process? The official Syncthing has a setting to run as a persistent service, which always helped me.

Otherwise see if you can make system exceptions for the app to run in the background, and allow it to auto-sync. It's been a while since I used the forked app, buy it did help me out on a device where the official didn't work for me.

Hope this helps.

[–] BearOfaTime@lemm.ee 3 points 2 days ago

Fork works much better on Android, largely because it moves sync conditions into the individual sync jobs (what ST calls folders).

[–] eramseth@lemmy.world 3 points 1 day ago

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.

[–] 0x0@programming.dev 4 points 2 days ago

I’ve been trying syncthing,

It's what i use but on the phone i only turn it on when i want to sync, otherwise it might drain battery. Always running on the PC.

Mega also works.

[–] TerkErJerbs@lemm.ee 10 points 2 days ago (2 children)

I use LocalSend between all my devices (work, personal, etc). Mac, Linux, Android, Winblows. All. It's fast, effective, lightweight. FOSS.

[–] Bluefruit@lemmy.world 3 points 2 days ago (1 children)

I was recently looking for something like this and couldn't find what i was looking for, so thanks!

[–] TerkErJerbs@lemm.ee 2 points 2 days ago

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.

[–] bandwidthcrisis@lemmy.world 2 points 2 days ago (1 children)

Thanks, but I really need a seamless automatic sync. I think that's a manually-triggered file send?

[–] TerkErJerbs@lemm.ee 1 points 2 days ago (1 children)

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.

[–] bandwidthcrisis@lemmy.world 1 points 2 days ago (1 children)

Well, it's not versioning I need (I have an rsync backup that makes incremental copies). I need a 2-way sync that happens when files changes and doesn't randomly stop working: I want to edit a note on my phone - it copies to the server. Edit on the server, it updates to the phone. Without having to manually run any separate syncs first. I only mention sync conflicts because right now, syncthing hadn't updated with my phone for over 2 days, plenty of time for me to update a note elsewhere and then edit the same note on the phone.

Resilio does it, but it looks like it's draining the battery. Syncthing doesn't drain the battery much, but that's because it has become inactive on two different phones for long periods of time repeatedly.

Cloud provider apps usually work instantly with little drain, they must trigger from OS notifications, but the apps that sync to local servers just don't seem to work that way!

Git is a great solution just for versioning. After I messed up a big note file I had, I set up emacs to hook git into the save function. I just created a repo in that directory, then backed up the whole directory including .git, so the versioning was there with the backup. No need to even use a separate repo, git just gave me a version history for the local files.

[–] TerkErJerbs@lemm.ee 2 points 2 days ago

That was the same issue I had with SyncThing, it just seemed to conk out at weird times and I gave up on it (for that purpose). It's great for centralizing a directory of files from one machine to another but I didn't love it for keeping a single file up-to-date with changes coming from more than one point on the network.

[–] uninvitedguest@lemmy.ca 5 points 2 days ago

If this is mostly for Obsidian, use the community plugin and a self hosted CouchDB.

https://github.com/vrtmrz/obsidian-livesync

I've found it quite good.

[–] talkingpumpkin@lemmy.world 2 points 2 days ago

2 more cents :)

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.

[–] timeslip1974@lemmy.world 5 points 2 days ago (1 children)
[–] bandwidthcrisis@lemmy.world 1 points 2 days ago (1 children)

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.

[–] timeslip1974@lemmy.world 4 points 2 days ago

I didn't see the file sync part.for that I use next cloud.which works great but my he overkill if that's all your going to use it for

[–] Tramort@programming.dev 4 points 2 days ago (1 children)

Resilio sync is outstanding

It's free for personal use, but the license process is annoying (email)

[–] bandwidthcrisis@lemmy.world 1 points 2 days ago (2 children)

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(.

[–] BearOfaTime@lemm.ee 2 points 2 days ago* (last edited 1 day ago) (1 children)

Yea, I like Resilio, but it's a battery and ram hog.

Syncthing should work fine for you.

Does your phone have some custom battery management? Some vendors do that, and it causes issues.

[–] bandwidthcrisis@lemmy.world 1 points 2 days ago (1 children)

The only setting I see is "allow background usage", which is on (I'm using it on a Pixel 7 and 8).

[–] BearOfaTime@lemm.ee 2 points 1 day ago (1 children)

Pixel is clean, from a battery saver perspective, so that's probably not your issue.

Not sure what to do next. I've used it for about 10 years now, and keep gobs of stuff in sync with it.

I do recommend Syncthing-Fork for Android, it moves the sync conditions into the individual since folders, so you get finer control.

Do you get any errors on the desktop console? On Android, if you launch the web client you get much more info and configuration capability (Menu - Web GUI). Once there, click the gear at the top right, and open Logs. Maybe there's something there that can help.

[–] bandwidthcrisis@lemmy.world 1 points 1 day ago

I'm trying the fork now, thanks. So far, it's behaving. Thanks for the pointer to the logs, I'll take a look if it happens again.

[–] Tramort@programming.dev 1 points 2 days ago

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.

[–] electric_nan@lemmy.ml 2 points 2 days ago

I use Nextcloud. I run it in Yunohost.

[–] JubilantJaguar@lemmy.world 1 points 2 days ago

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.

[–] deadcatbounce@reddthat.com 0 points 2 days ago* (last edited 2 days ago)

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.

[–] Ziglin@lemmy.world 0 points 2 days ago

I've used Sycthing but it was somewhat finicky.