Sync a subfolder of an already synced folder

Hi all,

I have been using Syncthing for one year now and it’s great: many thanks for it. I have a question on how I’m using it for a specific case: so far it has worked correctly, but I was wondering whether this is an ok way of setting it up and eventually if there is a better way of doing this.

There are (at minimum) three computers: A, B, C. A is always running, B and C can be running or not. A and B have the folder ~/mainpath synchronized in both directions. C is synchronized only with a subfolders (subpath1). Like this:

*** Computer A (always running)

~/mainpath
~/mainpath/subpath1
~/mainpath/otherstuff

*** Computer B (not always running)

~/mainpath
~/mainpath/subpath1
~/mainpath/otherstuff

*** Computer C (not always running)

~/subpath1

Setup 1, which I tried:

*** Computer A (always running)

~/mainpath <-> shared with B
~/mainpath/subpath1 <-> shared with C
~/mainpath/otherstuff

*** Computer B (not always running)

~/mainpath <-> shared with A
~/mainpath/subpath1
~/mainpath/otherstuff

*** Computer C (not always running)

~/subpath1 <-> shared with A

Setup 2, which I have also tried:

*** Computer A (always running)

~/mainpath <-> shared with B
~/mainpath/subpath1 <-> shared with C
~/mainpath/otherstuff

*** Computer B (not always running)

~/mainpath <-> shared with A
~/mainpath/subpath1 <-> shared with C
~/mainpath/otherstuff

*** Computer C (not always running)

~/subpath1 <-> shared with A and with B

Thanks again.

If this is a simple home setup with nothing else to consider, then I personally would go with Setup 2 simply for redundancy. Computer A may be “always running”, but if something breaks and the machine is not accessible, then you can always have the files still synced using Computer B (as long as B itself has the newest version of them). Of course, you can always just connect C and B only later, when there is such a need, so this may not really matter much.

I don’t know what happens if one computer tries to sync the same file in ~/mainpath/subpath1 using setup 2, e.g. computer B downloads the same file from C and A simultaneously using two syncthing folders. Maybe it does not cause any problems but I would not trust it and use setup 1 to be sure.

Thanks a lot to all of you for your comments. Because the setup is actually made of more than three computers and could be expanded even further, I would also prefer setup 1, where computer A should be considered as a server.

My main concern, though, was related to the fact that computer A - in case of setup 1 - has a shared folder shared and one if its subfolders is also shared. When setting it up, Syncthing gave a warning about this. Everything seems to work, but I think that warnings are there for a reason. :slight_smile:

I would be curious to know if this sharing a subfolder of an already shared folder is still ok to do or if there is there a better a way of doing it?

Thanks again, best regards.

It’s ok to do. The warning is there, as you can absolutely do bad things, despite nesting itself not being bad. E.g. creating cycles, like having folder B within A on one device, and A within B on another.

2 Likes