by Danny Quah. Jan 2022
Software syncthing
runs on Linux, Windows, and Android. It "replaces proprietary sync and cloud services with something open, trustworthy and decentralized.": syncthing
syncs not to any commercial or public Cloud but purely between my machines. This note describes how I set up syncthing
to synchronize folders across my Linux, Windows, and Android devices.
A lead syncthing
use-case for me is to synchronize Obsidian vaults across all my machines, including smartphones.
- Install
syncthing
on at least two machines. - Run
syncthing
on desired machines. On Windows look inTask Manager
to make suresyncthing
is present and chugging away. On Linux check ifsyncthing
is running by going to a shell and doingps aux | grep syncthing
. (On Windows, run thesyncthing
app if it's not already executing. On Linux ifsycnthing
isn't running, you might need to do something like/usr/bin/syncthing -no-browser &
, or however it is you like to run such things.) Below in this writeup I will remind myself how I need to make suresyncthing
starts up each time on boot-up. - Check all is working by pointing my browser on each machine to http://127.0.0.1:8384 ; on Android, use the
syncthing
app. In either case the screen should show my localsyncthing
management page. If all is working the screen will contain sections for "Folders", "This Device", and "Remote Devices", and possibly other things. This screen is what I will use to managesyncthing
on each of my machines. - On the
syncthing
management screen on any one of these machines --- perhaps call this machine Mc0 --- click the button "+ Add Remote Device" and input two fields: First, "Device ID" --- if necessary take this from the other machine, say Mc1. Find "Device ID" under "Actions > Show ID": the "Device ID" is an 8x7 string of characters or a QR code. Sometimes , I might not even have to do anything explicitly as Mc0 will automatically detect machine Mc1 (and possibly others) on my local Internet or WiFi. In that case, just click on the field for that machine. Additionally and optionally fill in a "Device Name" of my choice that will uniquely identify Mc1 to me - the "Device Name" has no significance tosyncthing
; it is meant only to aid humans. Close. - The browser on Mc1 will pop up a message saying Mc0 wants to connect. (This might take a few minutes to happen, depending on the task cycles on my machines and local Internet.) Accept.
- For completeness, back on Mc0, do Actions > Settings, and on the General tab, fill in what I want for Mc0's "Device Name". The other fields can be left as they were for now. Similarly, go over to Mc1 and do all the same.
- So far I've connected machines. Now I need to specify what folders on the connected machines I want
syncthing
to synchronize. - Back on Mc0, in the "Folders" panel, click button "+Add Folder" and input "Folder Label" (optional, again descriptive to humans but irrelevant to the machine). The field "Folder ID" should already be filled in by the software --- don't change this unless (you know what you're doing and) there is a good reason for doing so. "Folder ID" is meant to be a nonsensical 2x6 string of characters - chosen randomly to be nonsensical to minimise the probability of ID-collision. This ID will be unique and the same across across all my machines for the counterpart folder on each machine that is to be synchronized under this Folder ID. Finally, the most critical, "Folder Path" - fill in the path and then the name of the folder I want synchronized. Software
syncthing
fills in its estimate for what that might be, but edit this to what I need. Take care to get this field right. Save. - Now on Mc1, on the webpage I'm using to manage
syncthing
for Mc1, there should be a pop-up (might take a minute or two) saying that Mc0 wants to share a folder. Say yes, and that will take me to a page again asking for the same information "Folder Label", "Folder ID", and "Folder Path" as in the previous step. This information will now be what applies to Mc1. "Folder Label" can be set to be the same as that in the previous step as that's the most logical and helpful, but nothing hinges on this - again, "Folder Label" is just to help humans; it's irrelevant to machines. "Folder ID" should be automatically filled in; it needs to be the same nonsense sequence of 2x6 characters as in the previous step: This is howsyncthing
knows it is these folders to be synchronized. It looks at "Folder ID". Finally, for "Folder Path": Be very careful here. What I type in here needs to be the full folder path leading up to and including the folder name for the folder on Mc1 that I want synchronized with that other folder on Mc0 that I named in the previous step. If I get this wrong,syncthing
can wipe out everything in one or the other of these folders, so double check it is exactly how it needs to be. Save. - Now
syncthing
should start syncing between the folders I've just shared between Mc0 and Mc1. Try adding a file to the folder on Mc1 and see how long before it appears on Mc0. Or delete a file. Or edit one. Get a sense for howsyncthing
works by doing these small experiments. - (If you want to be extra careful, try out these steps above first on sandboxed, extra, unnecessary folders - where you won't lose anything essential if something goes wrong. When you have confidence things are working right, then move actual production folders into this sharing and syncing.)
- Things to look out for:
1. Software
syncthing
can get very confused if I add a large file to sync, and then before it's done syncing I change the file or take it away. For those working with superfast Internet and machines, this might not matter and might never even get noticed. However, try to minimise doing things like this in general but especially on slower hardware. 2. On Windows, file and folder names are not case-sensitive; on Linux, they are. So if on a Linux machine I have, say, files "1.t" and "1.T",syncthing
will get very confused trying to sync these two different files with a Windows machine where these two are, in effect, meant to be just one and the same file. Bad things happen. It might be obvious for simple filenames but not for say "ThisLongFileName.txt" vs "ThisLongFilename.txt" 3. My experience is the first time I try to sync a large folder,syncthing
will take a good while to complete the job. I try not to mess with either Mc0 or Mc1 during that initial syncing. But after that, small changes propagate quickly, better than linearly in size (although that is purely impressionistic on my part). - To finish up, make sure
syncthing
autostarts with each machine on which it's supposed to be running. How I do that varies with systems. It's best to follow the appropriate section of something like https://docs.syncthing.net/users/autostart.html