Using Syncthing with a removable hard drive

Hi,

My laptop’s hard drive is too small to contain all of my data, so I use an external (removable) hard drive for some of my stuff, which I still want to be synced with some other computers (which do have a large enough hard drive).

I do not plan to move my hard drive between the computers, and even if so, It should not matter, I think, as I plan to add mounted folders to SyncThing only from my laptop.

So here’s what I expect that would happen: everytime I unplug my hard drive (it will be unplugged 99% of the time), SyncThing will report a missing folder. When I replug it, SyncThing will “find” the missing folder (perhaps only after some time or after a manual “rescan”?).

Do you think this is a good practice? Do you think SyncThing may exhibit some unexpected behaviour, or shout at me? Would you recommend an alternative pattern?

(All of my relevant computers are running on Ubuntu 18.04 currently).

Thanks!

Syncthing is designed to be able to work in such setups. What it does behind the scenes is create .stfolder in each folder that is set up to sync. If at some point later Syncthing tries to read this folder, and .stfolder is not there (this may happen if the folder was a mounted filesystem that got unmounted), Syncthing stops working on that folder. Basically, exactly the behaviour you expect.

There’s one caveat to keep in mind, though. Imagine a folder structure like:

+-- foo/
|  +-- bar/ <-- [a mountpoint of a removable filesystem]
|  |  +-- file01
|  |  +-- file02
|  |  +-- file03
|  +-- baz/
|  |  +-- file04
<...> etc

If you share bar, you’re in the clear, as described above.

However, if you share foo, then .stfolder only gets created in foo, not in bar or baz. So in case bar gets unmounted it just looks to Syncthing that all the files in it got deleted by you, and it will happily delete these files on all the remote devices, too.

3 Likes

Thank you for your detailed explanation! (and for being a contributor…)

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