Handling of symbolic and/or hard links on Linux

(Chris Green) #1

I’m a little confused by the FAQ entries on how syncthing handles both symbolic links and hard links.

So, if there is a file in a directory synchronised by syncthing which has other hard links to it will these hard links be lost? I suspect they will because when syncthing updates a file it presumably changes its inode (i.e. it doesn’t update ‘in place’).

… and secondly I think syncthing will synchronise a symbolic link but not the file it points at. I.e. the pointer is preserved/changed but not what it points at.

Do I have these correct?

(Simon) #2

Yes. Syncthing copies files on all changes, therefore doesn’t preserve hardlinks, and syncs symbolic links themselves, never their targets.

(Jakob Borg) #3

If this clarifies things for you, let us know how to improve the FAQ entry. In my mind, imsodin said almost exactly what the FAQ entry says. :slight_smile:

(Chris Green) #4

Well I think it could do with a little bit of expansion. What the FAQ says is:-

Symbolic Links (synced, except on Windows, but never followed.)

This doesn’t quite say “syncthing will synchronise a symbolic link but not the file it points at”

… and:-

Hard Links (followed, not preserved)

You really, really don’t “follow” a hard link. I think one should say syncthing always creates a new copy of the file and that the hard link is destroyed. If there happens to be another hard link to the same (original) file then the original file will still exist.

(Audrius Butkevicius) #5

We should just say not preserved.