What are hardlinks on windows 7?

5

1

What are hardlinks and how are they different from files?

If i have a hardlink would all apps believe the link is a file? (I had programs not open files because they were shortcuts) If i modify a hardlink, does it modify the original or create a copy and modify that?

user3109

Posted 2011-01-07T20:38:48.653

Reputation:

Technically, hardlinks are files. Or rather, names for a file. – user1686 – 2011-01-07T21:00:52.837

Answers

8

When you save a file on an NTFS filesystem, it creates the file somewhere on the drive, then creates a reference to it in the Master File Table (MFT). When a program requests a file, Windows looks in the MFT for the filename, and if found, returns the information the filename points to.

A hard link takes an existing file (or folder) and creates another, different entry in the MFT that points to the same data. To programs, both files look like different files with the same information, but they are actually the same file. If you modify one file, the other one is changed too because they are actually the same file going by two different names. Hard Link diagram

This is different from a shortcut, because a shortcut is actually a file itself that contains information about the target. Shortcut diagram

TuxRug

Posted 2011-01-07T20:38:48.653

Reputation: 1 616

Hard links can only be used for files, not directories though. – David d C e Freitas – 2011-04-12T07:12:46.627

2

From the Developer's Tidbit:

For Window users unfamiliar with hard links, they not are unlike file and folder shortcuts. Except for one critical difference they are sorted and registered by the operating system’s file partition just like real files and directories. This means that unlike a shortcut, any program or application (including Windows Explorer and the Command Prompt) that looks that the hard link will always treat it the same as the original file or folder the symbolic link is pointing to.

http://ipggi.wordpress.com/2009/09/07/windows-file-junctions-symbolic-links-and-hard-links/

Check out this article from the How To Geek:

http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/

From MSDN:

Hard Links and Junctions

studiohack

Posted 2011-01-07T20:38:48.653

Reputation: 13 125