Syncthing in Subfolder w/ Removable Hard Drive

I found the following thread relating to external hard drives, and wanted to ask a follow up question to the answer @nekr0z gave, since in the example given the recommended usage for this purpose is avoiding mounting a directory above the external HD by mounting at the external HD mount point itself as a folder (if i’m understanding correctly)?

however, would it be OK to sync into a folder inside the external HD?

for example, say i already have a folder like this on another computer ready to sync via syncthing:

+-- folder/
|  +-- file01
|  +-- file02
|  +-- file03

and on the computer i am syncing to it would look like this:

+-- externalHD/ <-- [a mountpoint of a removable filesystem]
|  +-- synced-folder/ <-- [syncthing folder]
|  |  +-- file01
|  |  +-- file02
|  |  +-- file03
|  +-- other-folder/ <-- [unsynced folder]
|  |  +-- file04
|  |  +-- file05
+-- internalHD/ <-- [unsynced]
|  +-- folder/ <-- [unsynced]
|  |  +-- file01
|  |  +-- file02
<...> etc

Likely just a little mismatch in terminology… :slightly_smiling_face:

It’s fine to place the mount point of your external storage anywhere you’d like, but avoid it being a subdirectory of the root of a Syncthing folder because whenever the external storage is unmounted Syncthing cannot tell if it’s because all of the files under the mount point have been deliberately deleted.

Yes

Since we’re talking about mount points and the example above uses a forward slash, I’m guessing it’s a Unix/Linux/BSD system?

If so, the tree command makes life a lot easier… :nerd_face:

mkdir folder ; cd folder ; touch file01 file02 file03 ; cd .. ; tree folder

Results in:

folder
├── file01
├── file02
└── file03

1 directory, 3 files

If internalHD is the root filesystem, the directory layout above would be highly unusual, but if externalHD and internalHD are just mount points below /, then I don’t see any issues.

Alternatively, based on your example above, this would also work fine with Syncthing:

internalHD/
├── folder
│   ├── file01
│   └── file02
└── mnt
    └── externalHD
        ├── other-folder
        │   ├── file04
        │   └── file05
        └── synced-folder
            ├── .stfolder
            ├── file01
            ├── file02
            └── file03

6 directories, 7 files

I added the .stfolder directory to illustrate what Syncthing adds and will look for – https://docs.syncthing.net/users/faq.html#how-do-i-serve-a-folder-from-a-read-only-filesystem

1 Like

honestly, i was just copying the format of the previous poster when i was making my post - the file system in question is actually Windows as i was going to just sync it to an external drive that i have semi-permanently plugged into my gaming PC. So here’s a more accurate representation of the target file system, sorry for the confusion:

+-- E:\ <-- [a mountpoint of a removable filesystem]
|  +-- synced-folder\ <-- [syncthing folder]
|  |  +-- file01
|  |  +-- file02
|  |  +-- file03
|  +-- other-folder\ <-- [unsynced folder]
|  |  +-- file04
|  |  +-- file05
+-- C:\ <-- [unsynced]
|  +-- folder\ <-- [unsynced]
|  |  +-- file01
|  |  +-- file02
<...> etc

my server (where the existing syncthing folder is) runs linux, and i do have a raspberry pi running home assistant i could do backups to as well, but i don’t want to do more more write ops to that flash than i need to tbh.

Does the OS matter at all for this purpose? does syncthing handle missing directories differently at all on different OS?

i’m rereading the last part of your post and the link you sent; is it possible to set the folder marker to be elsewhere somehow - such that it is not on the external HD? would that help?

or is that something that we want to happen rather, the .stfolder to go missing (when the external HD is unplugged) so that syncthing doesn’t think that files are deleted?

Generally speaking, the OS doesn’t matter, but there are some little things such as symlinks that might need extra attention (https://docs.syncthing.net/users/faq.html#what-things-are-synced).

Whether the external drive on your Windows host is assigned a drive letter or attached/mounted to a folder, Syncthing’s marker folder (defaults to .stfolder in the root of a Syncthing folder) is how Syncthing decides when it should automatically pause/unpause syncing when the external drive disappears.

Syncthing supports customizing the name and location of the marker folder, but keeping it in the folder to be synced on the external drive is the simplest and least complicated option.

You got it.

That’s really helpful, now I understand, thanks