Keep Multibooted folders separate or combine?

I have a PC which I can boot either into Windows 10 or Linux Mint. For most of my data I use a NTFS data partition as a common file system which can be accessed by either so I can use either OS to work on the same files if they are in that partition.

At present I use different partitions for Syncthing. The Syncthing instance I use in Windows is in the NTFS partition (this is not the C drive) but the Linux one is currently in a different ext4 partition. They both sync to another local PC. This means I am using twice the space in the same machine (on the same hard disc but different partitions). Also,when the other local PC is disconnected, changes I make in Linux do not update the files in the Windows instance if I reboot to Windows, and vice versa.

Would it be possible for me to use the instance of Syncthing in the NTFS partition as my Syncthing partition in Linux Mint? In other words, whichever OS I boot into I use the one NTFS Syncthing folder.

My folder structure in each instance is the same. There is an overall folder called “Syncthing” which contains a Config folder and also some synced data folders - I don’t use the Default Folder. It looks to me like my 2 “Syncthing” folders (one in the NTFS partiton and one in the ext4 partition) are identical in structure, but I’m not sure if there are subtle differences because of the OS being used, or whether Syncthing uses some hidden OS specific stuff buried elsewhere in the respective OS’s.

In general you should be able to use the same storage for both Syncthing instances. But to avoid conflicts, it would possibly make sense to also share the database and configuration of Syncthing. That means there will be only one instance and one device ID, which is handled by either OS you currently booted into. Syncthing being cross-platform helps in that regard. I’m not 100% sure its “home folder” can be used like that in different OSes, maybe other developers can confirm that compatibility.

Speaking from personal experience, it can. I would make sure to disable automatic updates and always keep the two binaries in the same version to avoid any possible conflicts though.

Paths in the database are folder-relative and we don’t explicitly try to do platform specific stuff so in principle it can work. In practice we look quite closely at file metadata like modification times and permissions which, even if the underlying physical store is the same, might be represented slightly differently in the OS APIs. So you might want to use ignore permissions and modtime window to relax these checks if you see unexpected conflicts or rescanning after reboot.

And heed @tomasz86’ advice on running the same version on both flavours… The wire protocol is compatible between different versions but the on disk database schema is not, and gets auto upgraded to the latest on startup.

I’d also add that you will likely have to use relative paths for your folders, since Windows and Linux cannot reuse the same full paths (i.e. X:\... vs /...). I mean something like ./folder relative to a specific folder on the disk. Note that you can use forward slashes / in your Syncthing paths in Windows too.

Thanks for the info. 3 questions

I’ve found ignorePerms and modTimeWindowS, which I will set to 2 as a precaution.

Q1: In the Starting Syncthing Automatically — Syncthing v1 documentation it has a section on Permissions which says:

Permissions If you enabled the Ignore Permissions option in the Syncthing client’s folder settings, then you will also need to add the line UMask=0002 (or any other umask setting you like) in the [Service] section of the syncthing@.service file.

I’m not sure what the purpose of this umask is but in any event I think it may not be relevant since I’m starting Syncthing in Linux using this command line: bash -c ‘syncthing -no-browser -home=/data/LocalData/Syncthing/Config’ so I don’t think this is controlled by systemd. Does this sound right?

Q2: You say paths are folder relative - relative to which folder? In Windows I have a synced folder D:\LocalData\Syncthing\mydata
In Linux it would be /data/LocalData/Syncthing/mydata/

where the config is in D:\LocalData\Syncthing\Config\config.xml or /data/LocalData/Syncthing/Config/config.xml

How do I express the synced path as relative?

So in this example if it’s relative to the parent of the Config folder maybe it would be just mydata/ ? Or if it is relative to the Config folder (which is what I use for Syncthing’s home) it might be …/mydata/ (this is dot dot slash, not what it looks like in this forum post) ? Would that work in Windows?

Q3: In order to avoid auto update I presume I must also avoid autostarting Syncthing in both OS’s as the update might presumably modify the config or other system data so that it might upset the old version being booted on the other OS which is not expecting altered config etc.

Relative to the “current working directory” of the syncthing[.exe] process. In Windows, it depends on how you start it – the working directory can be set in a shortcut (.lnk) file, or for a Windows Service if you configured that. In linux, it should be whatever directory you execute that script from.

It should suffice to enter it in Syncthing’s configuration with a leading ./. That’s portable (I assume) and indicates clearly to your future self that it should be a relative path. Of course you have to choose the working directory such that the relative paths point at the same thing, e. g. D:\LocalData\Syncthing and /data/LocalData/Syncthing, then use ./mydata for the folder path.

No, you can just set autoUpgradeIntervalH to zero to disable checking. See Syncthing Configuration — Syncthing v1 documentation.

I guess I can experiment with the paths until it finds the right folder.

In Q3 I wasn’t asking how to avoid auto update, but whether I also need to avoid autostarting because of potential side effects when one instance is updated and the other OS is booted into the old instance before I have a chance to update it.

Sorry, misunderstood that. In general Syncthing is quite fool-proof when starting an older version on a home folder already touched by a newer version. It notices newer DB or config versions, then bails out gracefully. There is even an -allow-newer-config flag just in case you need it. If you leave the internal auto-updater enabled, that will try to update to the latest release before choking on the newer config.

This is what I’ve been doing personally. Feel free to modify and adjust to your preferences.

  1. In Windows, create a batch script called syncthing.cmd in D:\LocalData\Syncthing.
    cd /d "%~dp0"
    set "STNOUPGRADE=1"
    ./syncthing.exe -home=./Config
    
  2. In Linux, create a bash script syncthing.sh in /data/LocalData/Syncthing.
    #!/bin/bash
    cd $(dirname "$0")
    chmod +x ./syncthing
    STNOUPGRADE=1 ./syncthing -home=./Config
    
  3. Start Syncthing by executing one of the two scripts according to the OS.
  4. Once started, use the Web GUI to set the default folder path to ./mydata.
  5. Use forward slashes / in your folder paths in Syncthing regardless of the OS.

That’s basically it. The scripts will make sure your current working directory is set to the one with the Syncthing binary, and any newly created folders will have the ./mydata path prepended.

Thanks for all the help. All working perfectly now using only one set of data. Tomasz’s detailed instructions were great, thanks.

In Linux Mint, Sycthing came from the Syncthing repository so to be on the safe side I locked the current version using Synaptic. I’m not sure if this was necessary but I suspect it might otherwise update when the repository is updated irrespective of Syncthing’s settings.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.