Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

What is the difference between a junction and a symbolic link?

Junctions links work only for the absolute path. Symbolic Links works for both absolute and relative path. Symbolic Links works for local as well as remote paths. Creating junction links does not require any special permissions, and Windows Standard User is sufficient.

Does NTFS support symbolic links?

Symlinks, or symbolic links, are “virtual” files or folders which reference a physical file or folder located elsewhere, and are an important feature built in to many operating systems, including Linux and Windows. The Windows' NTFS file system has supported symlinks since Windows Vista.

Is an NTFS junction point?

A junction, also called an NTFS junction point, is a feature of the NTFS file system. It is pointer to a directory on the local volume, similar to a symlink. It can be accessed through the Windows GUI in addition to the Windows command line.

What is symlink Junction?

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.


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.


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.


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.


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.]


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