# Syncthing configuration -- (selective) syncing to many devices

**URL:** <https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651>\
**Category:** Workbook/Workshop\
**Created:** [July 17, 2024, 8:21am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651 "2024-07-17T08:21:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/hans/32/719_2.png) [@hans](https://forum.johnnydecimal.com/u/hans)\
**Post date:** [July 17, 2024, 8:21am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/1 "2024-07-17T08:21:28Z")

</div>

The challenge of configuring Syncthing has come up several times, including [This thread](https://forum.johnnydecimal.com/t/why-does-jd-have-nested-folders/1627). It was starting to get technical there so I thought we could use a dedicated thread for the nitty gritties.

There, [I noted](https://forum.johnnydecimal.com/t/why-does-jd-have-nested-folders/1627/13) that I’d experimented with the API and that I’d write more when I’d figured it out – that will be in this thread.  
@fender [replied](https://forum.johnnydecimal.com/t/why-does-jd-have-nested-folders/1627/14) with some details on their setup – which I will respond to first.

The gist was:

> Things I want synced to multiple locations / devices live in my 9\* area of JD  
> Single means only one generation / 1 copy  
> Multi means multiple generations with autocleanup / versioned backups back in time
> 
> ![2024-07-16 22_59_11](https://forum.johnnydecimal.com/uploads/default/original/1X/a03ec3181133b7031077b3d55a2ab30d7972aac0.png)

Do I understand correctly:

- this is primarily meant for ‘archives’ that you want distributed? If not, I would find this very limiting since the category name and location would be dictated by the tool rather than their content.
- I suppose it would be less limiting if you want to make a clear distinction between ‘archival’ material that hardly changes, versus hot stuff which might be more specific to each device. In my setup, I mix those up a lot more.
- do you move things around ‘manually’ using your ‘transfer’ folder? I can actually see some benefit to that. You always know when something is being moved to another physical machine. I think I want, though, to synchronize working files automatically. I’m also sharing this system with someone else. (though we have used a ‘inbox’ sync folder for each of us in the past … might be an idea to use that more).

I have used the following backup strategy in the past:

- one central server ( raspberry pi)
- multiple portable devices (laptops, phones)
- the server is a peer of each of the portables with continuous sync
- every night, the server’s copies are backed up incrementally

I did this because of the hassle of when to run backups on my laptop: I don’t want it on all night, and I never make time to run backups during the workday.

Next, I want to write about using the `.stignore` file. But first, back to work.

---

<div class="post-metadata">

**Author:** ![johnnydecimal](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/johnnydecimal/32/1759_2.png) [@johnnydecimal](https://forum.johnnydecimal.com/u/johnnydecimal)\
**Post date:** [July 17, 2024, 9:10am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/2 "2024-07-17T09:10:31Z")

</div>

Looking forward to this!

This is how we run JDHQ. While Syncthing has no concept of ‘the primary copy’, I do. And it’s on the massive hard drive attached to the always-on Mac mini in the cupboard.

So that instance has a different backup strategy, and different Syncthing versioning rules. So far this has worked really well for us. We were burned with other sync solutions and I love how pure Syncthing feels.

---

<div class="post-metadata">

**Author:** ![fender](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/f/848f3c/32.png) [@fender](https://forum.johnnydecimal.com/u/fender)\
**Post date:** [July 17, 2024, 1:35pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/3 "2024-07-17T13:35:01Z")

</div>

**An attempt to describe / outline the backup regime - where Syncthing is part of it:**

- 0a

- 0b

- 1

 ![1_index](https://forum.johnnydecimal.com/uploads/default/original/1X/34d864ffa0b696a63b5714aa10ec0696ca42401b.png)

```
* JD_B\ (*technical reason - since this is backup* *target* *, it is split into separate "Shared folder" in Synology NAS - b for backup*)

```

 ![2_index2](https://forum.johnnydecimal.com/uploads/default/original/1X/8f2d3c5984f588a3c97e6aff0e50eb027a30c6b5.png)

- 2
## BACKUP - intent / design / what should it cover:

  - Trying to protect against / reason for backup / the most likely bad things to happen:

 ![3_remote-control-socket](https://forum.johnnydecimal.com/uploads/default/original/1X/b73069f8865decb97e4ef6eaa98f48ebde71dfc1.png)

- USBCopy (Synology) \*described further down - (automagically copy files to external USB drive when connected or powered on)  
\* rsync (Synology) \*described further down

- **Scenario 3** :

- 3

 ![5_Hyper_backup](https://forum.johnnydecimal.com/uploads/default/original/1X/0867c627a7d0706ec00ba019b38a35ab43a4ede2.png)

- **Cloud Sync** (Synology NAS)

 ![6_Cloud-Sync](https://forum.johnnydecimal.com/uploads/default/original/1X/aae6f6b100d5cf059bc16399726111544b4d2b22.png)

- **USB Copy** (Synology NAS) \> can set trigger conditions and tasks - example; run task if external drive is connected or powered on
- 

 ![4_USB-COPY](https://forum.johnnydecimal.com/uploads/default/original/1X/875e93f3bf2c8b68ca762f06f9786440adbecd46.png)

- **rsync**
  - I use built in rsync clients on Synology NAS servers, Hyper Backup with latest, older clients with the older
  - 

**NAS servers**  
\* [DS124](https://www.synology.com/en-global/products/DS124) \< main server, always on/powered - runs Syncthing  
\* [DS209](https://global.download.synology.com/download/Document/Hardware/DataSheet/DiskStation/9-year/DS209/enu/Synology_DS209_Data_Sheet_enu.pdf) \< for rsync backups, runs RAID1 w 2 drives, always on, powered  
\* DS107+ \< for less frequent rsync backups, poweroff most of the time, wakes on schedule

- **Sorry for long post…**
  - If anyone has any simplifications or things I’ve missed that should be covered, please hit me up

---

<div class="post-metadata">

**Author:** ![fender](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/f/848f3c/32.png) [@fender](https://forum.johnnydecimal.com/u/fender)\
**Post date:** [July 17, 2024, 6:47pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/4 "2024-07-17T18:47:10Z")

</div>

Oh yeah - forgot… just for completeness of the overview.

For **full system backups** (with restore possibility, also to other hardware/new drives):

- Was a long time fan of [Acronis True Image](https://www.acronis.com/en-us/products/true-image/), until they went for a subscription-only business model. I still have a perpetual license that I still enjoy that does the trick.

- For other (Windows) systems - (lower priority, but still don’t want to start from scratch if I need to re-deploy) - I use [AOMEI Backupper](https://www.aomeitech.com/ab/standard.html) Standard (free).

---

<div class="post-metadata">

**Author:** ![johnnydecimal](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/johnnydecimal/32/1759_2.png) [@johnnydecimal](https://forum.johnnydecimal.com/u/johnnydecimal)\
**Post date:** [July 17, 2024, 9:50pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/5 "2024-07-17T21:50:48Z")

</div>

> [@fender](#):
>
> **Scenario 4** :
> 
> - Global extinction event
> - **NEED**
> - Don’t think I need backup for this one.
> - No efforts made. 🌋

You do future alien archaeologists a dis-service!

---

<div class="post-metadata">

**Author:** ![hans](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/hans/32/719_2.png) [@hans](https://forum.johnnydecimal.com/u/hans)\
**Post date:** [July 18, 2024, 9:41am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/6 "2024-07-18T09:41:27Z")

</div>

Thanks for the detailed description @fender! I may be missing something, but it looks like most of your JD system isn’t managed by Syncthing?

---

<div class="post-metadata">

**Author:** ![hans](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/hans/32/719_2.png) [@hans](https://forum.johnnydecimal.com/u/hans)\
**Post date:** [July 18, 2024, 10:14am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/7 "2024-07-18T10:14:28Z")

</div>

### Syncthing awkwardness – the limitations of `.stignore`

Don’t get me wrong – I use Syncthing and in general, for what it does, it works really well.  
But there’s something I’ve run into in the past which is only exacerbated when dealing with a JD system.

that is: how do you only sync certain parts of your tree to various devices?

Example from my situation: I want to share a JD system with my partner, but there are a few folders which are specific to each of our businesses which do not need to be/should not be synced to the other person’s laptop.

Another example: I only want a few folders from my JD system on my phone, the whole thing takes up too much space. (this is not specific to JD – the same could apply with a photo or music collection, for example).

#### Sync each folder seperately

One solution is to make each category or even ID folder its own Syncthing folder. You can then select, on each folder, which devices it gets synced to.

For categories I can kind of see that working … but at the ID level? you’d have up to 10,000 folders if you stuck to classic 10.10.100 JD … not feasible.

I think a mix of syncing areas and categories might be realistic. But managing it might become confusing.

#### Limitations of the .stignore file

then there’s the **`.stignore`** file. Which seems like it would be the way to do this, but there are issues.

The [Syncthing documentation](https://docs.syncthing.net/users/ignoring.html) says the `.stignore` file is for controlling sync ‘to (or from) other devices’. Sounds good, but … ‘other devices’ means all other devices are treated as one. What that means: you only have one on/off switch for all outgoing/incoming data. You can’t say:

```txt
#in .stignore on laptopA

*.git #applies to all devices

[laptopB] #applies to laptopB
19.22 #sensitive client files

[phone] #applies to phone
45 #full of big archives

```

I am, personally, rather surprised that this a) is not possible, and b) doesn’t come up in my extensive searching through online discussions. It seems to me like the most obvious thing …

_ **EDIT** _ the problem is more or less the same as what people are talking about when they ask for ‘selective sync’ and point to other services like Dropbox or Rsilio which sync a pointer file to be downloaded on user request from the GUI. that, however, is GUI based and is also controlled from the _receiving_ end – see next section.

#### A solution – .stignore on the receiving device

there is a way to make this work. It is, unfortunately, not secure, strictly speaking. Whether that’s a problem kind of depends.

The solution is to put `.stignore` files on the devices where you want to _exclude_ stuff. So on `laptopB` you could put `19.22` and on `phone` you could put `45` and these devices won’t download stuff that matches those patterns.

This solves the problem of storage size.

My partner and I did this in our previous shared Sync folder for mobile devices: on our phones, we ignore everything with `*` and then allow a subset with `!*.mob.*` so that if we rename a file with `.mob.` in the name it will get synced.

This isn’t really secure, though, because if someone gains access to the device, they can remove the `.stignore` file to start receiving everything. Whether that is acceptable depends on your situation. I wonder, for example, if it would strictly pass EU data protection regulation if customer data is involved. (Actually, strictly speaking, relying on the presence of an ignore file is probably not best practise anyways, even if it worked as I desire).

So I don’t actually know of a really good solution to this.

I think the best way forward might be a mix of the two methods:

- `.stignore` on receiving devices for non-sensitive stuff, to reduce data usage
- put sensitive data in a separate area or system and make that a separate syncthing directory.

I’d be sad about that last point, though, because it would mean creating a high-level container just for the sake of making Syncthing work well, after all my hard work at getting everything comfortably down to half a JD system.  
I think I could live with activating two of my four currently unused Areas. One each for my partner and me, for sensitive business-related information. Then I would have eight folders to manage in Syncthing: six for our shared setup, and two for each of our two businesses, which would be almost empty since those are currently two categories under `00`.

---

<div class="post-metadata">

**Author:** ![fender](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/f/848f3c/32.png) [@fender](https://forum.johnnydecimal.com/u/fender)\
**Post date:** [July 18, 2024, 3:53pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/8 "2024-07-18T15:53:35Z")

</div>

> [@hans](#):
>
> I may be missing something, but it looks like most of your JD system isn’t managed by Syncthing?

Mostly the “Hot\_storage” folders are done by Syncthing, pulling data from various sources.

I see I’ve fallen into a setup where the structure is dictated by the tools.

@hans Thanks for an inspiring post about **.stignore**

- I had a tumble with it at some point when trying to do only certain files, but I struggeled to make it work the way I wanted (probably messed up the pattern and syntax).

- Read the docs, and your post gave me the urge to give it another go.

I am curious about having a global file that syncs to all devices, implemented by having this in the root .stignore

```auto
// Usage: Add the line below to all .stignore files for each Syncthing node
// #include .stglobalignore

```

and then adding all patterns in .stglobalignore (which is synced to all devices)

(example [here](https://gist.github.com/marksharrison/ec7646f9539a770f2e86b53c7fc7d309))

I am aware there are [pitfalls](https://github.com/syncthing/syncthing/issues/7311) and an existing long [discussion](https://github.com/syncthing/syncthing/issues/2491), but I might experiment with it. Will report back if I find it useful.

---

<div class="post-metadata">

**Author:** ![johnnydecimal](https://forum.johnnydecimal.com/user_avatar/forum.johnnydecimal.com/johnnydecimal/32/1759_2.png) [@johnnydecimal](https://forum.johnnydecimal.com/u/johnnydecimal)\
**Post date:** [July 19, 2024, 1:01am UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/9 "2024-07-19T01:01:38Z")

</div>

> [@fender](#):
>
> I am curious about having a global file that syncs to all devices, implemented by having this in the root .stignore

I could never get this working. Let me know if you can.

---

<div class="post-metadata">

**Author:** ![LasTr](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/l/e36b37/32.png) [@LasTr](https://forum.johnnydecimal.com/u/LasTr)\
**Post date:** [August 13, 2024, 3:12pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/10 "2024-08-13T15:12:39Z")

</div>

> [@hans](#):
>
> ```auto
> #in .stignore on laptopA
> 
> *.git #applies to all devices
> 
> [laptopB] #applies to laptopB
> 19.22 #sensitive client files
> 
> [phone] #applies to phone
> 45 #full of big archives
> 
> ```

This seems like an elegant solution that I would love to see in Syncthing. I think it would be cool if `[phone]` and `[laptopB]` were user-defined device or ignore groups—devices would all belong to one group (root group being default) but they could choose group names based on the headers in the ignore file.

Thanks also for pointing out the security issue—I hadn’t thought of that. For me, I just sync my entire Documents directory with its JD system between all devices, mobile or not. I guess I’ve been lucky in that I’ve never run out of space on my phone. I sync my mobile phone photos to my computer with Syncthing and archive them on a yearly basis.

---

<div class="post-metadata">

**Author:** ![fender](https://forum.johnnydecimal.com/letter_avatar_proxy/v4/letter/f/848f3c/32.png) [@fender](https://forum.johnnydecimal.com/u/fender)\
**Post date:** [August 13, 2024, 5:10pm UTC](https://forum.johnnydecimal.com/t/syncthing-configuration-selective-syncing-to-many-devices/1651/11 "2024-08-13T17:10:42Z")

</div>

I now have the following up and running:

**What I wanted to do:**

- I have a “todo” file in Logseq (it’s under 00-09 System in JD).

- Instead of having a separate “todo” app for the phone - I wanted to share and sync only this file (TODOS.md) file with Android devices, so I can tick things off with the Logseq android app while on-the-go - and then sync it back to “the master”.

**“Master device / main system (ON when used) - with Syncthing and Logseq”**

.stignore of Send&Receive shared folder

```auto
!/TODOS.md
*

```

(Result: shares only this single file and ignores everything else in the share folder.)

**“Always online server (always ON)” - with Syncthing**

no .stignore for this folder

(this is just to ensure that some device is always “online” with the lastest version - regardless of whether it’s the Android devices or the master device that is being used on that particular .md file at the moment)

**“Android device(s)” - with Syncthing and Logseq app**

```auto
!/TODOS.md
*

```

(to avoid other stuff being synced back to “always online server” - it would not go back to the “master” anyway because master has it’s own .stignore )

(I **will not** be editing the same .md file on both devices simultaniously. I’m either “on the go” or using the “master device” - so sync conflict of this single file is a less likely edge-case)

So far, working as desired.
