Syncthing

In regards to technology, most people have heard the term “the cloud” or “cloud storage”. A user chooses which files to upload to the cloud. Afterwards, the files are available to download to any device connected to the same cloud account.

To understand why Syncthing is important, it’s important to understand how cloud storage actually works. When a user uploads content to the cloud, it isn’t stored in some magical etheral space. In simplest terms, storing information on the cloud means the user is moving data from their computer, and storing it on someone else’s computer. Whether it’s Amazon’s, Google’s or Microsoft’s cloud servers, a user is really just giving files to store for them. The technology that makes this possible is actually very old. Some smart marketting team branded it “the cloud”, and pitched it as a new idea.

Typical Cloud Diagram

There are several issues with the consumer-based cloud solutions:

  • You’re trusting someone else with your data.
  • Reliance on a single remote storage location, and expecting it won’t go down.
  • Limitted storage space.
  • Cost associated with increasing storage capacity.
  • Potential recurring usage costs.

That’s where Syncthing comes in. Syncthing is similar to cloud storage. You can back up media that’s important to you, as well as sync the items across your devices. Where it differs however, is that Syncthing operates via a decentralized network. There is no central location where all the data is stored.

Syncthing Mesh Diagram

You’re not keeping your items on Google, Amazon, or whoever’s server. No other organization has access to your media. All devices are connected to eachother. Each connected devices becomes a cloud server. If one device is powered off, or otherwise goes down, another device is available to provide access to your files.

Syncthing UI

Syncthing is also customizable. It allows for choosing which devices are connected, and what they share with eachother. Through this way, complex configurations can be accomplished to suit individual needs.

Syncthing Custom Network

Devices on the same local area network (LAN) can sync with eachother without passing through the internet. Syncthing first looks at your LAN to see if any other devices are running Syncthing. If they have already been paired with, Syncthing connects the two devices. After looking on the LAN, it will connect via the internet to any remote devices which were previously paired.

Syncthing will begin synchronization if it detects a difference in any of the shared folders. The most recent version of the files will be synced to all the other connected devices. Syncthing will continue to monitor devices that connect or disconnect from the cluster.

Keep in mind: you can still configure Syncthing to behave like one of the commercial cloud storage services. In my home network, a Raspberry Pi is always powered on. The Pi uses a low amount of resources, and doesn’t waste much electricity. Because of this, the Raspberry Pi does act as my centralized server. If, however, the Raspberry Pi dies on me for whatever reason, I’ve got other devices to act as backup.

To give an example of Syncthing usage, here is the details for replicating a common cloud feature. Many cell phones have the ability to automatically backup photos and videos to a cloud service provider.

To accomplish this, first I downloaded the Syncthing Android app. Then I installed Syncthing on the Raspberry Pi. I paired the cell phone and the Raspberry Pi. This can be done by typing in a long string of identifying characters. However I took the easy route by using my phone to take a picture of the Pi’s QR code. Then, on my phone, I selected the folder I wanted to sync. The DCIM folder is where my photos were being saved by the Camera app. I specified the Raspberry Pi as the device to sync with. The last thing to do was to go to the Raspberry Pi’s interface, and choose where on the Pi to save the photos. That’s it. Automatic, private, photo backup, that only I have access to.

Another great usage of Syncthing is to integreate Nextcloud with Syncthing.