NTFS data files are stored with all their attributes as an "inode" with an ID, and filenames point to the inode. All files have one+ hardlink. some tools can create extra names (hardlinks) which point to the same inode, which has a counter of the number of names pointing to it. If the number goes to zero, the OS deletes the file, the inode.
Special tools, like LN can create additional filenames which point to existing inodes, using a filename that points to them. Note that all the file attributes, including dates and times are stored with the inode, not the filename.
(Extra) hardlinks are useful when you want different names to point to the same data, read or write. They save space and overhead. However, they clobber programs which assume different names point to different data. e.g, if you replace references to duplicate files by hardlinks to a single file, then you have removed any backup you have! The windows OS is one program which assumes different names point to different sets of bits.
Hardlinks have to be on the same physical and logical volume.
They are useful for:
reducing path lengths since Windows just supports 256 characters or so.
reducing storage space of duplicate data files - eg, you could have multiple backups of a partition with multiple complete directory trees, but with hardlinks for files which have not changed since the previous backup.
Junction points are messier and use Reparse Points (which I do not understand). They can point to different physical or logical volumes but they have to be on the same computer. They apparently can be used like symlinks for directories, allowing a second name for the same destination, but limited to a single computer, rather than just a single volume.
Useful for reducing path lengths, or simplifying working with several programs with hardcoded directory names.
Same caveats, too! Many programs assume different names = different files.
And then there are symbolic links (which can go across networks), shortcuts and PIFs and .....
Also some information from Microsoft itself:
Basically, they're saying to use hard links only for files within the same volume (disk drive letter) and junction points only for directories on the same computer (they can span across different local volumes).
A junction is definitely not the same thing as a directory symbolic link, although they behave similarly. The main difference is that, if you are looking at a remote server, junctions are processed at the server and directory symbolic links are processed at the client. Also see Matthew's comment on the fact that this means symbolic links on the local file system can point to remote file systems.
Suppose that on a machine named Alice you were to put a junction point c:\myjp
and a directory symbolic link c:\mysymlink
, both pointing to c:\targetfolder
. While you're using Alice you won't notice much difference between them. But if you're using another machine named Bob, then the junction point
\\Alice\c$\myjp
will point to \\Alice\c$\targetfolder
but the symbolic link
\\Alice\c$\mysymlink
will point to \\Bob\c$\targetfolder
(Caveat: by default, the system doesn't follow symlinks on remote volumes, so in most cases the second example will actually result in either "File Not Found" or "The symbolic link cannot be followed because its type is disabled.")
The difference between a directory symbolic link and a file symbolic link is simply that one represents a directory and one represents a file. Since the target of the link doesn't need to exist when the link is created, the file system needs to know whether to tell applications that it is a directory or not.
It should also be noted that creating a symbolic link requires special privilege (by default, only available to elevated processes) whereas creating a junction only requires access to the file system.
Best Answer
Tool To Copy Hard Links Across Separate Disk Partitions
LN - Command Line Hardlinks
Basic Instructions
vcredist
(Visual C++ Redistributable) and install it.C:\Temp
).cd /d C:\Temp
) and then run the needed commands for your drive locations as the above example command shows.Note: Running
ln --help
shows help detail but the above command example is supposed to copy thehard links
per the documentation.Potentially Relevant Functions
Smart Mirror
Clone
Smart Copy
Other Notes
It appears
hard links
are locked to the same disk partition for their file pointers, and cannot be used across multiple partitions. Also,hard links
on NTFS partitions are part of theMaster File Table
records—or attributes for the counts at least—so copying these to an existing disk that has it's ownMFT
could be a problem if you don't clone byte-for-byte at the partition level at least.