Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Technically, hardlinks are files. Or rather, names for a file. –  grawity Jan 7 '11 at 21:00

2 Answers 2

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

share|improve this answer
    
Hard links can only be used for files, not directories though. –  David d C e Freitas Apr 12 '11 at 7:12

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.