Linux – Samba breaking hard links – desired behaviour

hardlinklinuxsamba

I'm using Samba 2:3.5.4 in Ubuntu 10.10 Server, and an EXT4 filesystem.

I have setup a folder "dev" locally on my pc, and using "cp -alf" hard
linked that folder, to folder "test". So upon looking in the "test" folder it has exactly the same contents as the "dev" folder.

"test" is currently shared using Samba on the network.

If I change a file in "test" on the local file system. The change is reflected in the "dev" folder (as the folders are linked). This is as expected.

When a file in "test" is modified via a Samba share, the hard link is broken. Ie, the change will only apply to "test" and not to "dev".

Modifying files via Samba, and it breaking the hard links is actually what we want. What I've been asked (and I can't find any white papers on it), is this:

  • a bug
  • or as designed

The danger is, that if it is a bug, and we start using the above solution, when the bug gets fixed our setup will no longer work!

Anyone got any ideas,

Thanks.

Best Answer

I can't comment on Samba specifically, but often the particular application in use is responsible for breaking the links. Some editors, for example, replace a file -- instead of simply overwriting it -- when saving changes, which of course would break any hard links associated with the file...so, your behavior may be due more to the application you're using than to Samba.

Related Topic