In a previous post I contemplated the idea of replacing Nextcloud with Syncthing. Since then I’ve done exactly that. Syncthing is a great piece of software and this post is going to take a surface-level look at how I’ve settled into it.
From the Syncthing website:
“Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how it’s transmitted over the internet.”
Which is a long-winded way to say: Syncthing makes files and folders of your choosing available on any device of your choosing.
Nota Bene: Syncthing is NOT a backup solution. It is a file synchronization tool. In its default configuration, deleting a shared file or folder on one device deletes it on ALL linked devices. It is EASY to lose data if you are not careful. Be sure you have a separate, reliable backup solution before you start sharing files with Syncthing.
I’ll start by giving a high-level overview of my Syncthing likes & dislikes. I like Syncthing for a few reasons:
On the other hand, I dislike these aspects of Syncthing:
In my network I am using Syncthing to mesh together three devices:
As mentioned above, Syncthing doesn’t require a server. Instead, clients can talk directly with one another. Despite this I opted to create a hub-and-spoke model. My NAS acts as the hub into which all my other devices (the spokes, to keep up the analogy) share their files.
I went with this architecture because my NAS is built to be resilient - I run mergerfs to evenly distribute files onto two disks, which are parity-checked nightly on a third disk with snapraid to avoid bit-rot. Each disk is 8TB, providing a total of 16TB of usable storage. The NAS is also backed up nightly with restic. So, by serving as a hub my connected devices get free nightly parity checks and encrypted, versioned backups. Accidentally delete a file? No worries, my backups will likely have a record of it – even if I’ve performed a backup after deleting said file!
Installing and configuring Syncthing could be a blog post all on its own. Instead, here are a few interesting notes I took while configuring my Syncthing network.
While you can certainly open up ports or proxy traffic to-and-from Syncthing, I elected to keep the synchronization local-only. Beyond the usual cautions that come with port-forwarding, I found that Syncthing works great even when it doesn’t have a constant connection to my home network. I can create and edit files on my phone while I’m out-and-about. Syncthing will seamlessly mirror any changes to my other devices once I pop back onto the home network. There’s really no need for an always-on connection in my situation.
For some reason Syncthing defaulted to using Relays after I finished getting set up. Relays are community-provided servers which bounce traffic between your devices over the public internet. The documentation says these are only used when Syncthing can’t make a direct connection between clients. While this sounds nice in theory, relays often have painfully low throughput (in the kb/s range!). Considering I’m used to gigabit speeds this was making me pull my hair out. I was able to get direct connections working by doing the following:
Of course, this only works because I have pretty specific network segmentation via VLANs, PFSense, and static addresses. Your mileage may vary here.
While Syncthing’s GUI doesn’t offer a selective sync option, you can achieve the same effect with its .stignore
file. For example, let’s imagine you have this folder structure:
Where you are sharing the top-level folder, foo
, but maybe you only want foo/baz
on your phone. To selectively sync the baz
folder you could:
foo
folder..stignore
file and save it:!/baz
**
Then wait until the refresh interval or restart the Syncthing client on your phone. Breaking down the lines above:
**
means block everything.!/baz
is an exception rule for the foo/baz
folder. /
is interpreted as the root folder, foo
.So all together your ignore-file is saying: Don’t sync anything inside foo
except the baz
folder contents.
So far my use case is small-but-mighty. If you aren’t sure how Syncthing could fit into your toolkit, maybe these examples will spark ideas:
receive only
mode to avoid accidental file deletions. As a bonus, the .stignore
file is checked into a dotfiles-style git repo. If I ever change phones I can simply copy over my .stignore
file and Syncthing will re-download my selections. Some day I will ansible-ize my Android installation and become all powerful.So that is it! Do you use Syncthing in a creative way? Do you know about a feature I’ve probably missed? Do you know how to address any of the problems in my “dislikes” list? Let me know!
P.S. If you haven’t seen the eleven-times-academy-award-nominated Everything Everywhere All at Once from which the article title draws inspiration, do yourself a favor and find it!!! I hope it wins EVERY award on March 12th!