Welcome to the Linux Foundation Forum!

Hard-Link content changed may not change content for other hardlink?

Options

In the Chapter "Linux Filesystems and the VFS"/"Hard and Soft Links" it says about Hard-Links:
"Changing the content of a hard linked file in one place may not change it in other places."

In this redhat-article it says about Hard-Links:
"The permissions, link count, ownership, timestamps, and file content are the exact same."

I read these statements as contradictory. Can anyone help me with the confusion?

Answers

  • coop
    coop Posts: 915
    Options

    https://forum.linuxfoundation.org/discussion/860783/16-hard-links

    discussed this before. In a perfect world changes would also occur in all hard-linked files simultaneously. However, a dumb application or user can break the link -- for example by copying a file, editing it, removing the old one and replacing it. If you do this by hand you will know you are breaking the link but if it is done by an application or script you may not realise it.

Categories

Upcoming Training