I created a hard link pointing to a file in my dropbox dir – the link was created inside a folder where this file needs to be in order to be accessed by the programs I use to edit it –
mklink /h path_to_hard_link C:\dropbox\git\repo\existing_file
I started working with the hard link alright. At some point I realized that the changes do not propagate to the file in repo\ – filesize, modification date, nothing – NOT EVEN the contents.
What am I doing wrong ?
EDIT : is it possible to be program dependent ? I mean the editor I use for these files does indeed edit them – but only edits the hard link. The file linked hasn't been modified. Moreover this editor does not seem to be able to follow symbolic links
EDIT2 : according to the article linked by surfasb :
Because a hard link is a directory
entry for a file, an application can
modify a file by using any of its hard
links. Applications that use any other
hard link can detect the changes.
Meaning the original file must contain the modifications when opened with an appropriate editor directly – not only via its hard link – right ?
However, directory entries for hard
links are updated only when a user
accesses a file by using the hard
link. For example, if a user opens and
modifies a file by using its hard
link, and the size of the original
file changes, the hard link that is
used to access the file also shows the
new size.
If I understand this deplorable specimen of english correctly this means that I can have 69 hard links (up to 1023 actually) to the same file showing different sizes for that same file ?!
EDIT 3 : well according to surfasb I do understand this correctly – a limitation of the filesystem. Anyway – strange thing – this is not always the case – sometimes the change in the attributes is immediately visible back to the original file – when there is change – my real concern now is that at least one program I am using does not seem to edit the file linked but only the hard link. Possible ?
dir /a
does not reveal much about hard links – any way to see them ?
Best Answer
I think the answer is (quoted from some helpful guy) :
So yes - hardlinks can and will break - which limits their usefulness - badly thought.
correct me if wrong