Synchronizing data between computers and mobile devices using Syncthing

Node Network

After you have transmitted the settings to all the nodes involved, the next step is to introduce the devices to one another. The 46-digit individual device ID that was generated from the information in the certificate for each device when it was first launched is used for this purpose; it can be accessed via the Show ID sub-item.

You can transmit this ID either in the form of a text file using a USB flash drive, load it using a smartphone and a barcode scanner (Figure 4), or distribute it by email or various other web services. Then, enter the ID in Syncthing's front end via the Add Device button together with the previously specified device name. Using the Introducer option in the Edit Node dialog, choose whether all nodes that are entered on the distribution system should also be used on the new device.

Figure 4: The easiest way to load the ID for your computer is using a barcode scanner.

Using the ID and the unique device name, you can now keep data on your devices in sync and share content with colleagues and friends. You can configure the Syncthing GTK graphical interface in the UI Settings window via the Syncthing icon at the top left. There, you can, among other things, integrate the service into the file manager in Gnome, Cinnamon, or Mate.

Adding More Directories

When it's first started, Syncthing creates the ~/Sync folder in the home directory of each device by default. It automatically incorporates all files stored here and recursively all contained subdirectories, including their contents, in the data synchronization. However, when larger volumes of data need to be synchronized, you can add further folders with their own settings to the Syncthing configuration.

After clicking Add Folder or Add Shared Folder from the Syncthing GTK menu (Figure 5), enter the folder's unique name in the dialog for Folder ID and then navigate to the target directory. The directory must be set up on all computers, and the ID must be identical. The respective target directory can, however, have a different name on each device.

Figure 5: Syncthing automatically creates backups using File Versioning.

The Folder Master option stands out among the other settings. If you enable this setting, Syncthing protects the corresponding folder against changes made on other devices. However, Syncthing still transfers changes made on this device to the rest of the network. A file only disappears from other devices once it has been deleted in one of the protected folders.

The Search Interval option (Rescan Interval in current versions of the application) determines how often Syncthing searches for new or changed data. You can, by all means, extend the predefined rest period of 60 seconds on inefficient systems. If necessary, load all directories concerned by clicking Check All (Rescan All) at any time.

Syncthing provides different modes for creating and organizing backups of data managed using Syncthing under the File Versioning item [11]. Depending on your needs, you can either completely forgo backups or use a Simple versioning in which Syncthing keeps a fixed number of copies of deleted or changed files in the hidden directory .stversions. Even the expiration date for versioned copies can be determined in the Staggered versioning variety. An external command writes the backup copy for external versioning.

If the data for the added folder is on a filesystem with no administrative rights (e.g., FAT), you can make sure that the changes to file permissions fall by the wayside using the Ignore Permissions option. Next, select the Syncthing devices with which this directory will be synchronized in Share With Devices. If necessary, you can exclude subdirectories from synchronization using the menu item Ignore Patterns. After sharing the new folder, you need to confirm the integration of the connected computers (Figure 6).

Figure 6: You need to confirm a new directory for the remote computer on the target computer.

Android App

The Syncthing Android app (Figure 7) is still in the early stages of development; however, it can already be used in a meaningful way. The app innately enables the folder where the smartphone or tablet camera stores images. As with the desktop counterpart, the app also shares further directories with the Syncthing network as needed. The configuration is analogous to the PC version. Additionally, the app offers the option to become active only when WiFi is available or when the cellphone is charging.

Figure 7: You will want to start Syncthing for Android only when needed, because it consumes a huge amount of power.

The app's power hungriness is one of its greatest weakness. If the mobile phone is set up to search constantly for changes and synchronize new data (Figure 8), Syncthing remains active the whole time, meaning that the smartphone used in the test heated up significantly and the battery life degraded noticeably. It is therefore advisable to launch Syncthing only when it is needed, instead of running the daemon in the background.

Figure 8: Syncthing currently adversely affects battery life in the long term. You should therefore disable the background service.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News