What is the difference between NTFS Junction Points and Symbolic Links?

WindowsSymlinkNtfs

Windows Problem Overview


At a high level, the only obvious difference between NTFS Junction Points and Symbolic Links is that Junctions are only able to be directories, while SymLinks are allowed to also target files.

What other differences between the two exist?

(Note, I've already seen this question and what I'm looking for is a bit different -- that question is looking for a pro and con list, I'm looking for a set of technical differences)

Windows Solutions


Solution 1 - Windows

Symbolic links have more functionality, while junctions almost seem to be a legacy feature because of their limitations, but the security implications of these limitations are specifically why a junction might be preferred over a symbolic link. Remote targeting makes symbolic links more functional, but also raises their security profile, while junctions are safer because they are constrained to local paths. So, if you want a local link and can live with an absolute path, you're probably better off with a junction; otherwise, consider a symbolic link for its added abilities.

enter image description here

*The statement of difference in speed/complexity comes from an unverified statement in the Wikipedia entry on NTFS reparse points (a good read).

**Ever since the Windows 10 Creators Update, one can enable Developer Mode to remove the admin restriction for NTFS symbolic links.


Other NTFS Link Comparisons

Here are some other comparisons on the topic, but these can be misleading when considering junctions because they don't list the benefits I list above.

Taken from here (a good introductory read)

enter image description here

From SS64 page on MKLink

enter image description here


Comments about Terminology

Junctions are Reparse Points (may be described as symbolic links)

NTFS Junctions and NTFS Symbolic links are really doing the same thing in the same way (reparse points), aside from the aforementioned differences in how they're processed. In fact, technically, a Junction is a "symbolic link" in the more general sense of the word, and sometimes documentation might call a Junction a symbolic link, as is the case here. In such cases, "symbolic link" does not mean NTFS Symbolic Link which is different than a junction (see below).

NTFS

Even though the OP specifies this, it's worth pointing out that "symbolic link" is a very general term that is not specific to NTFS. So, to be specific, this comparison is about NTFS Junctions vs. NTFS Symbolic Links.

Solution 2 - Windows

The places I find the most useful for the differences:

http://blogs.msdn.com/b/junfeng/archive/2006/04/15/576568.aspx

http://www.hanselman.com/blog/MoreOnVistaReparsePoints.aspx

> Postulate: Symlink is to Junction in Windows as Symlink is to Hardlink in Unix.

http://en.wikipedia.org/wiki/Symbolic_link#Windows_7_.26_Vista_symbolic_link

> Windows 7 and Windows Vista support symbolic links for both files and directories with the command line utility mklink. Unlike junction points, a symbolic link can also point to a file or remote Server Message Block (SMB) network path. Additionally, the NTFS symbolic link implementation provides full support for cross-filesystem links. However, the functionality enabling cross-host symbolic links requires that the remote system also support them, which effectively limits their support to Windows Vista and later Windows operating systems.

http://www.tuxera.com/community/ntfs-3g-advanced/junction-points-and-symbolic-links/

> A symbolic link, as created by Windows, is much similar to a directory junction, but unlike a directory junction it can point to a file or a remote network file or directory. The target may be defined as a path relative to the symbolic link position, or an absolute path in the current volume or another one. Also note that symbolic links to files are different from symbolic links to directories and the target must match the definition.

Solution 3 - Windows

Functionally, in windows, once created, there is no real difference. However, there are significant differences between them in what they can do. Junctions can be used only for the creation of links to folders, either on the same drive or different drives, but only if those drives are on the local system (you can not create a junction link to a folder over a network.) Symbolic links however, do not have the same restrictions. Symbolic links can be used to link to either files or folders and those files or folders can be located either on the same system (same drive or different drives) or to a network share and can make use of relative location symbolics ("\\system2\foldera\file.txt", "d:\foldera\file.txt", "\\system2\foldera", "d:\foldera" or "d:\foldera\folderb.." with the resulting link for the last 2 examples being the same location.) Relative location symbolics can be ".", "..", current drive relative function (if current drive is c:, then specifying "\tempa\folderb" results in a link to c:\tempa\folderb,) and current directory relative (if the current directory is d:\foldera\folderb, then specifying "d:file.txt" results in a link to d:\foldera\folderb\file.txt.)

To sum it up: Junctions Points are limited to folders on the local system only, while Symbolic Links can create links to folders or files accessible via a UNC path or on the local system with more versatility in how those locations are designated. Symbolic Links is basically a more versatile replacement for both Junction Points and Hard Links. Plus, Symbolic Links are compatible with Unix and Linux when creating a cross platform UNC pathed link.

Hopefully, this answers your question in a satisfactory manner. Edited to correct typographical errors.

Solution 4 - Windows

Link Shell Extension, http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html, is a great tool for creating and viewing many kinds of links. It also has excellent documentation.

[On a full install, it adds a new properties tab if you're looking at an advanced link. At also adds icon-overlay arrows for the various link types - scroll to the FAQ section if these do not show up; Windows only supports thirteen overlays; he shows a registry workaround. An example of its informational usefulness: Unsuccessfully trying to get privileges to what you thought was a folder, but in fact was a system-provided Junction Link, often used for compatibility purposes with older editions of Windows.]

Junctions and Symbolic Links act essentially identically when created for a directory on a local system.

However:

They act differently over a network. This link describes this behavior: https://superuser.com/questions/343074/directory-junction-vs-directory-symbolic-link

If you think of Junction Links as "shortcuts that fool the OS as to location" you'll have a good practical simile of their use and what breaks them. The main difference is that if you copy Symbolic Links or Junctions, it copies the target, rather (like shortcuts) merely the file that contains the pointer. As with shortcuts, you can delete Symbolic or Junction Links without removing the target files/folders. [Hard Links, the file is only deleted with the removal of the last link - including from the recycle bin. Look at the properties tag in LSE for any of these links to see the target or the reference count for Hard Links.]

Hard Links or Shortcuts are the only link types that can be moved with no side-effects like breaking or copying the entire target. Moving the target always breaks the links, though they can easily be updated in the properties tab (shown with LSE) or re-created, if complicated, with LSE.

The creation of Symbolic Links requires administrator privileges whereas Junctions do not. This plus the extensive, internal OS use of Junctions suggests that Windows handles them in an intuitive, expected manner. [Do be somewhat wary of unexpected side-effects from system folders (from experience with Win 10).]

[Some of the backup-specific features of Link Shell Extension are extremely useful - in short, it can create several types of updatable symbolic link structures in standard folders for pending backup purposes.]

Solution 5 - Windows

In addition to the excellent answer from u8it:

If anyone is interested in the difference in behavior in Windows File Explorer in Windows 10:

drag & drop to target directory:

  • symbolic link: moves the symbolic link to the target directory
  • junction: moves the original directory to the target directory

right mouse click + properties:

  • symbolic link: shows you shortcut properties
  • junction: shows you original directory folder properties

left moue click in the left pane (directory tree):

  • symbolic link: selects the original directory
  • junction: selects the junction

Solution 6 - Windows

Symbolic links have been introduced very recently in Windows : as from Vista.

Symbolic links should not be regarded as an alternative to the existing NTFS "Reparse Point" technology.

Microsoft explains that the sole purpose of Symbolic links is to be more compatible with Unix.

> MSDN : "Symbolic links have been designed to aid in migration and application compatibility with UNIX. Microsoft has implemented its symbolic links to function just like UNIX links."

Vista is also the firt OS to use links for its own functioning. To be compatible with legacy folder names, C:\Documents and Settings is now a link to C:\Users.

Interestingly, although Vista introduces Symbolic links, this "Documents and Settings" trick is actually a plain old junction.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBilly ONealView Question on Stackoverflow
Solution 1 - Windowsu8itView Answer on Stackoverflow
Solution 2 - WindowsJames ManningView Answer on Stackoverflow
Solution 3 - WindowsTechno WizardView Answer on Stackoverflow
Solution 4 - WindowsClayView Answer on Stackoverflow
Solution 5 - WindowsJinjinovView Answer on Stackoverflow
Solution 6 - WindowsPhilipView Answer on Stackoverflow