In Order to Create a Hard Link, What Command Must Be Used?
Understanding NTFS Difficult Links, Junctions and Symbolic Links
Writer: Conrad Chung, 2BrightSparks Pte. Ltd.
Download PDF version [opens new window]
Microsoft has implemented linking tools in its NTFS operating file systems since Windows NT four.0 and Windows 2000. These links provide a convenient method for users to access their data.
Over the years Microsoft continued to improve these tools which tin now exist used to link files and/or directories together. The latest form of file link was introduced in Windows Vista and continues to form part of their latest operating organisation. In this article we will wait at what these file links are and how they differ from ane another.
What are NTFS Hard Links, Junctions and Symbolic Links?
Difficult links, junction points and symbolic links are linking processes used by Windows to associate other files, directories or volumes. One of the methods to create file links is to utilize the command line program mklink:
- To create a file difficult link: mklink /H linkName target
- To create a directory junction: mklink /J linkName target
- To create a directory symbolic link: mklink /D linkName target
- To create a file symbolic link: mklink linkName target
The following sections describe each type of file link in detail.
Hard Links
A hard link is a file that represents another file on the same volume without duplicating the information of that file. More than i hard link can be created to point at the same file. Hard links cannot link to a file that is on a unlike partition, volume or drive. Hard links on directories are non supported as it would lead to inconsistencies in parent directory entries.
Although a hard link is essentially a mirrored re-create of the target file that it is pointing to, no additional hard drive space is required to shop the hard link file. If a 1GB file is mirrored by 3 hard links, the total space used on the partition volition simply be 1GB instead of 4GB.
In addition, if any of the hard links or the original file(s) is/are deleted, the information will not exist deleted, and the rest of the other links will still be able to access it. The file is only deleted one time all links to information technology, and the file itself, are deleted. Changes made to the data contents via any of the hard links or the original volition be propagated to the rest of the other items automatically (equally they all ultimately point to the same file data) .
Hard links only work on Microsoft Windows operating systems that support NTFS partitions (Windows NT iv.0 or later) while FAT and ReFS file systems do not work with difficult links.
An case of using hard links is when a user needs to accept a file stored in two different folders. He could copy the file to the other folder and have two copies of the aforementioned file. However, twice the corporeality of storage space would exist used. Besides, if file contents of one file is changed, the other file will be outdated unless the newer file is copied over to replace it. Both bug could exist solved with the use of difficult links.
Junctions
Sometimes referred to as soft links, the part of a junction is to reference a target directory, unlike a hard link which points to a file. Junctions can exist created to link directories located on different partitions or volume, but only locally on the same computer. Information technology does this through the implementation of the NTFS characteristic called reparse points. Redirected targets in junctions are defined past an absolute path. An accented path refers to a path which will contain the root chemical element and the complete directory list that is required to locate the target. For example, \Main\Folder\written report is an absolute path. All the information required to locate the target is contained in the path string.
Similar hard links, directory junctions do not take up boosted space even though they are stored on the drive partition; their function is to point to the original files in the original directory. Thus, it should be noted that if the target is deleted, moved or renamed, all junctions which signal to the target will break and continue to point to a non-existant directory. Content changes from any of the junction links or the target volition automatically propagate to the balance.
An example in which junctions are often used is on Windows Vista (and newer), where the name "C:\Documents and Settings" is a junction that points to C:\Users. Thus, older programs that reference hard-coded legacy file paths can go along to piece of work in Vista and newer.
Symbolic Links
Symbolic links were introduced in Windows Vista/Windows Server 2008. An NTFS symbolic link is a file arrangement object that points to another file system object. In simpler terms, it is a more advanced type of shortcut. Symbolic links tin point to any file or folder either on the local calculator or using a SMB path to point at targets over a network (the target auto on the remote end needs to run Windows Vista or later on). They practice not use whatever disk space.
A symbolic link can use either a relative path or an absolute path to bespeak to its target. A relative path must be combined with some other path in order to properly access the target file. For a detailed explanation betwixt the divergence of absolute and relative paths, please refer to Microsoft'south documentation.
Symbolic links are transparent to users – they announced as normal files or directories. All applications volition be able to recognize both the link and the target. Like junctions, symbolic links will become a stale link if the target is moved, renamed or deleted. The operating organization does not check to encounter if the target exists.
Comparison tabular array of difficult link, junction and symbolic link
| Hard Link | Junction | Symbolic Link | |
| Supported Bone | Windows NT4 or later | Windows 2000 & Windows XP or afterward | Windows Vista or later |
| Storage requirement for target | Files must be on the aforementioned book | Directories (paths) must be on local calculator | Whatsoever path – local or remote, relative or accented SMB file or path |
| When a hard link/junction/symbolic link is deleted using Windows Explorer… | The original file and other hard links pointing to it remains. If all associated links are removed, the data is deleted | Windows Vista or later on: target is unchanged. Windows 2000, XP & 2003: target & sub-folders are deleted | Target is unchanged |
| The target is moved… | Difficult link stays valid | Junction turns invalid | Symbolic link turns invalid |
| Relative path allowed? | Not applicable | Not immune; path becomes absolute when saved | Allowed |
| Works on files? | Yes | No | Windows Vista or subsequently |
| Works on directories? | No | Yes | Windows Vista or later |
Examples of a hard link and junction
Configuration Settings in SyncBackSE & SyncBackPro that use file links
In the backup and synchronization programs – SyncBackPro/SE/Gratuitous, users are provided with some settings to choose how they want the program to handle these links if encountered during a contour run.
Good > Compare Options > Attributes > Ignore NTFS junction points (reparse points) – Configurable in all 3 models of SyncBack, this setting is recommended and turned on by default. Junctions and symbolic links are ignored during profile runs with it enabled, but hard links are not ignored. This setting supports both NTFS and ReFS file systems. Information technology should exist noted that if this setting is disabled, SyncBackPro/SE/Free could copy the files stored inside the 2 dissimilar paths (the original path and the link path) twice and create 2 real folders of those names on the Destination.
Expert > Copy/Delete > Advanced > Copy symbolic links as-is instead of copying the file the link points to – When this setting is enabled, the program will copy only the symbolic link and not the file that the link points to. This ways the link on the destination volition be pointing to the same file the source link is pointing to. Thus, users who enable this setting need to ensure the symbolic links are using relative paths instead of absolute paths. This setting is only available in SyncBackSE and SyncBackPro. Pre-requisites to apply this setting are: This option is just available on when the Standard Windows File Re-create method is beingness used and is only used when copying between NTFS or ReFS file systems. Delight also note that this setting volition non work (and is disabled) over FTP, Deject, etc. and the contour cannot have compression enabled every bit symbolic links must be stored 'natively' on the drive.
Summary
Now yous have the basic knowledge on how hard links, junctions and symbolic links work in a NTFS Windows operating arrangement, you are hopefully in a better position to recognize problems relating to them.
Source: https://www.2brightsparks.com/resources/articles/ntfs-hard-links-junctions-and-symbolic-links.html
0 Response to "In Order to Create a Hard Link, What Command Must Be Used?"
Post a Comment