<< Click to Display Table of Contents >> Navigation: Using SyncBackPro > Expert Mode > Copy/Delete, Links |
There are numerous ways to link files and folders. This settings page is concerned with how those links are handled or ignored.
Files
•Automatically update shortcuts when they are copied or moved: SyncBack can be configured to automatically change shortcuts that are copied so that the copy points to the correct file. For example, if your source is C:\ and your destination is D:\ and you copy a shortcut that points to C:\abc.txt then you may want it to be changed (in the destination) to instead point to D:\abc.txt. In this example you would set the root folder for shortcuts on the source/left to C:\ and the root folder for shortcuts on the destination/right to D:\. In general the shortcut root folder is the same the source and destination folders, except when you are copying to UNC paths or network drives. In that case the shortcut root folder should be based on the drive on that remote computer.
•Do not copy reparse point files: If enabled then files that are marked as reparse points are not copied. These files are often special files, e.g. links on Windows Subsystem for Linux (WSL) file-systems. See the explanation below.
•Preserve file hard links: Hard links are explained below. It is important to remember that a hard link does not point to another file but points to the contents of a file. Multiple files on a volume (drive) can all share the same file contents. When copying a hard link to another volume, a new file on the target volume is created, thus losing the link. By enabling this option, SyncBack will try to preserve hard links by having the copy of a hard link point to the appropriate file contents on the target volume. Hard links can only be preserved for files within the base folder. Note that enabling this option can impact the performance of the profile as SyncBack needs to get all the hard links for every file that is scanned. See the section below on important points to remember when copying hard links. The Differences window will show hard links when the profile is run (attended).
•Copy symbolic links as-is instead of copying the file the link points to: If enabled, and a symbolic link file (see description below) is being copied, then instead of copying the file the link points to it copies the link. This means the link on the destination will point to the same file the source link points to. Because of this you may want to make sure the symbolic links are relative and not absolute. For example, let's say you have a symbolic link on the source that points to C:\abc\def.txt. When copied to the destination the destination link will still point to that same file. However, if the link was relative and instead pointed to ..\def.txt then the destination copy of that link would defer to the def.txt file on the destination. This option is only available when the Standard Windows File Copy method is being used, and is only used when copying between NTFS or ReFS file systems. Please note that symbolic links are not the same as hard links (see below).
oWhen possible, modify links to use correct drive: Copies of file symbolic links can only be modified when they are absolute and are for files within the base folder. For example, if your profile is configured to copy from C:\My Files\Backup 1\ and there is a symbolic link that points to C:\Other Files\example.txt (for example) then such a link cannot be modified because the file is outside of the base folder. If the link pointed to C:\My Files\Backup 1\Sub Folder\example.txt (for example) then that can be modified (as it is ultimately under the base folder of C:\My Files\Backup 1\). Relative links are not modified and copied as-is and unchanged.
Folders
•Ignore NTFS junction points (reparse points): If ticked then junction/reparse points are ignored (as are directory symbolic links). File hard links are not ignored. Note that although NTFS is mentioned explicitly, it is also valid for ReFS. If you change this setting you should also update your file & folder selections. Pre-V11, this option was enabled by default. From V11 onwards, this option is disabled but the following option (ignoring backwards compatible junction points) is enabled.
•Ignore Windows backwards compatibility junction points (reparse points): In Windows Vista and Windows Server 2008, the default locations for user data and system data changed. For example, user data that was previously stored in the %SystemDrive%\Documents and Settings directory is now stored in the %SystemDrive%\Users directory. For backward compatibility, the old locations have junction points that point to the new locations. For example, C:\Documents and Settings is a junction point that points to C:\Users. If this option is enabled then those backwards compatible junction points are ignored (as the data is stored in other directories). Enabled by default. If you change this setting you should also update your file & folder selections.
•Copy symbolic links and junction points as-is instead of copying the directory the link points to: If enabled, and a symbolic link, or junction point, (see description below) is being copied, then instead of copying the directory the link points to it copies the link. This means the link on the destination will point to the same directory the source link points to. Because of this you may want to make sure the symbolic links are relative and not absolute (note that junction points cannot be relative). For example, let's say you have a symbolic link on the source that points to C:\abc\def. When copied to the destination the destination link will still point to that same directory. However, if the link was relative and instead pointed to ..\def then the destination copy of that link would defer to the def directory on the destination. This option is only available when the Standard Windows File Copy method is being used, and is only used when copying between NTFS or ReFS file systems. See the section below on important points to remember when copying links.
oWhen possible, modify links to use correct drive: Absolute symbolic links, and junction points (which are always absolute and not relative), can only be modified for folders within the base folder. For example, if your profile is configured to copy from C:\My Files\Backup 1\ and there is a symbolic link that points to C:\Other Files\Example (for example) then such a link cannot be modified because that folder is outside of the base folder. If the link pointed to C:\My Files\Backup 1\Sub Folder\Example (for example) then that can be modified (as it is ultimately under the base folder of C:\My Files\Backup 1\). Relative symbolic links are copied as-is and unchanged
If you are copying directory symbolic links and junctions points, do not forget to go to Decisions -> Folders and change the setting for "What to do if the properties or the case of the directories are different". |
What are junction points (reparse points)?
Sometimes referred to as soft links, the function of a junction is to reference a target directory, unlike a hard link which points to a file. Junctions can be created to link directories located on different partitions or volume, but only locally on the same computer. It does this through the implementation of the NTFS feature called reparse points. Redirected targets in junctions are defined by an absolute path. An absolute path refers to a path which will contain the root element and the complete directory list that is required to locate the target. For example, C:\Main\Folder\report is an absolute path. All the information required to locate the target is contained in the path string.
Like hard links, directory junctions do not take up additional 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 point to the target will break and continue to point to a non-existent directory. Content changes from any of the junction links or the target will automatically propagate to the rest.
An example in which junctions are often used is on Windows Vista (and newer), where the name C:\Documents and Settings is a (hidden) junction that points to C:\Users. Thus, older programs that reference hard-coded legacy file paths can continue to work in Vista and newer.
Unlike symbolic links, you do not need to be an elevated administrator to create a junction point.
You can see junction points using the dir /A command in a command prompt window. To list only junction points and symbolic links use dir /AL
Symbolic links were introduced in Windows Vista/Windows Server 2008. An NTFS symbolic link is a file system object that points to another file system object. In simpler terms, it is a more advanced type of shortcut. Symbolic links can point to any file or folder either on the local computer or using a SMB path to point at targets over a network (the target machine on the remote end needs to run Windows Vista or later). They do not use any disk space.
A symbolic link can use either a relative path or an absolute path to point to its target. A relative path must be combined with another path in order to properly access the target file. For a detailed explanation between the difference of absolute and relative paths, please refer to Microsoft's documentation.
Symbolic links are transparent to users – they appear as normal files or directories. All applications will 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 system does not check to see if the target exists.
You need to be an elevated administrator to create a symbolic links, unlike junction points.
You can see symbolic links using the dir /A command in a command prompt window. To list only junction points and symbolic links use dir /AL
A hard link is a file that represents another file on the same volume without duplicating the data of that file. More than one hard link can be created to point at the same file contents. Hard links cannot link to a file contents that is on a different partition, volume or drive. Hard links on directories are not supported as it would lead to inconsistencies in parent directory entries.
Although a hard link is essentially a mirrored copy of the target file that it is pointing to, no additional hard drive space is required to store the hard link file. If a 1GB file is mirrored by 3 hard links, the total space used on the partition will only be 1GB instead of 4GB.
In addition, if any of the hard links or the original file(s) is/are deleted, the data will not be deleted, and the rest of the other links will still be able to access it. The file is only deleted once all links to it, and the file itself, are deleted. Changes made to the data contents via any of the hard links or the original will be propagated to the rest of the other items automatically (as they all ultimately point to the same file data) .
Hard links only work on Microsoft Windows operating systems that support NTFS partitions (Windows NT 4.0 or later) while FAT and ReFS (older than V3.5) file systems do not work with hard links.
An example of using hard links is when a user needs to have a file stored in two different folders. He could copy the file to the other folder and have two copies of the same file. However, twice the amount of storage space would be used. Also, 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 issues could be solved with the use of hard links.
It is important to note that all files are hard links. A hard link is a directory entry that associates a filename with a files contents. All files must have at least one hard link. When you create a hard link you tell the operating system the name of an existing file that you would like to create an alias for. However, that is only so that the operating system knows which file contents you are referring to. It does not mean the hard link points to that file. It means that now both files point to the same file contents. For example, if you create the file C:\test\myfile.txt, and then create the hard link (to that file) called C:\myfiles\textfile.txt, you could delete myfile.txt (the original file) and the file would still exist.
You can list the hard links for a file using the command line utility fsutil, e.g. fsutil.exe hardlink list C:\Windows\System32\notepad.exe
A shortcut is a special type of binary file (with a .LNK extension) used by the Windows shell (the Windows desktop interface, which is Explorer). Unlike symbolic links, hard links, etc. a shortcut file is not implemented by the underlying file system, it is just a normal file that the Windows shell uses. For example, you can open a shortcut file in a file editor.
Shortcuts are typically used on the Windows desktop and in the Windows Start menu.
Reparse point files are used to implement features such as Microsoft OneDrive cloud files appearing as normal files on your drive. Junction points and symbolic links are implemented using reparse points. Basically, reparse points are used to extend the functionality of the file system (NTFS and ReFS, not FAT). A reparse point contains user defined data and a unique reparse point tag. When a reparse point is opened, Windows calls the file system filter driver to process the file. The reparse point tag defines which filter driver to call. That filter driver can then optionally use any user defined data in the reparse tag to decide how to process it. By using this method, Windows can add features to the file system without changing the underlying file system. However, it also means that these features cannot be used by other operating systems (on a local drive) if they do not have the filter drivers installed.
You cannot create reparse point files.
What is the difference between a soft link and a hard link?
A soft link (junction point or symbolic link) is a link to another file or directory. You can delete what a soft link points to without the soft link itself being deleted. In this case a soft link is broken (it points to something that does not exist). A soft link can also become invalid if you rename the file or directory is points to.
A hard link connects a filename to data (file contents). All files are hard links and only files (not directories) can be hard links. You can think of a hard link as an alternative filename or the reference to data. What a hard link points to (the data) is not deleted until all the hard links pointing to that data are deleted. As a hard link does not point to another file, it cannot become broken (like a soft link can). If you rename a hard link it still points to the same data.
What is the difference between "absolute" and "relative"?
Symbolic links can be absolute or relative. An absolute link includes the volume (drive letter, UNC path, etc.) and specified the complete filename, e.g. C:\Folder\Sub Folder\filename.txt. A relative link gives a path relative to the directory (or volume) the link is in, e.g. ..\another_folder.txt, SubFolder\subfile.txt, etc. Note that a path that starts with a backslash, e.g. \Folder\file.txt, is a relative path (as it is relative to the volume the link is on).
What about copying to or from UNC paths?
When the information for an absolute link is retrieved from a UNC path (\\server\share\folder\) then it is given for the local drive it is on and is not related to the UNC path is being access via. For example, a remote Windows Server has drive E: which is available over the network via the UNC path \\WINSERVER\MYSHARE\. When SyncBack asks for the details for a link the server will return it for the local E: drive, e.g. E:\folder\file.txt. Because of this, it is impossible to remap links on UNC shares.
You can also have the issue where SyncBack thinks that a remote link matches a local link. For example, you could have a link on your local computer that points to C:\Example\. On the remote computer, accessed via a UNC share (for example), there could also be a link that points to C:\Example\. One points to the local C: drive and the other points to the C: drive on the remote computer, so they are two entirely different drives. However, SyncBack cannot know if that is true. For example, the remote C: drive may be mapped to the local computers C: drive or both may be mapped to the same drive on a third computer (if a symbolic link is used or a drive letter has been mapped to a remoter computers drive). There is no way for SyncBack to know this. There are two ways to avoid this. One way is to use relative paths in the links instead of absolute paths (only if symbolic links are used). The other is to use the Volume GUID instead of the drive letter. Both solutions also avoid the issue of drive letters changing as they will always point to the same volume regardless of the drive letter (which can change, e.g. if it's removable media). Another solution is to use SyncBack Touch on the remote computer and access it via that.
When copying directory links there are important points to note:
•When copying directory links (junction points or symbolic links) you are copying the directory link itself and not any files or sub-folders within the directory. When copying directory links SyncBack will not scan the files and folders in the directory. It's similar to copying a file.
•If you receive the error "The matching directory on Destination is not a symbolic link or junction point" then this means that, for example, the source directory is a symbolic link (or junction point) but the destination directory is a normal directory. SyncBack cannot simply delete the destination directory (and all the files and sub-folders in it) before replacing it with a link. You must resolve the issue, e.g. rename the destination directory, delete it, etc.
•Unlike file hard links, junction points and symbolic links are soft links, meaning what the link points to may not exist, i.e. a soft link can be broken.
When copying file hard links, it may look like SyncBack is going to copy the entire file and not the file as a hard link. However, this is not the case. As explained above, a hard link is not a link to another file but a link to the contents of a file. When SyncBack needs to copy a hard link it must find the matching contents in the destination. That may not exist yet. When SyncBack copies a hard link it will check to see if the contents the hard link points to already exists in the destination. If it does then it will link to that, otherwise the copy is just like a normal file copy (as this is the first hard link). The log file will show if a hard link was created or the file was copied.
The Differences window displays the hard link information (if any) when you select a file (in the details section at the bottom-left of the window). Hints also display link information.
When a version of a file is made, it will be a copy and not a link.
IMPORTANT: If you change the contents of a hard link then it may not be immediately reflected in all the hard links.
Comparing link types
Hard Link |
Junction |
Symbolic Link |
|
Minimum supported OS |
Windows NT4 |
Windows 2000/XP |
Windows Vista |
Storage requirement for target |
Same volume |
Directories must be local |
None |
When the link is deleted... |
The data and other hard links pointing to it remains. If all associated links are removed, the data is deleted. |
Windows Vista or later: target is unchanged. Windows 2000, XP & 2003: target & sub-folders are deleted |
Target is unchanged |
The target is moved… |
Hard link stays valid |
Junction becomes invalid |
Symbolic link becomes invalid |
Relative path allowed? |
Not applicable |
Not allowed; path becomes absolute when saved |
Allowed |
Works on files? |
Yes |
No |
Windows Vista or later |
Works on directories? |
No |
Yes |
Windows Vista or later |
Security requirements |
None |
None |
Elevated administrator |
Pre-V11 versions of SyncBack did not check if a directory had already been scanned due to a junction point, or symbolic link, linking to it. V10 and older only checked if a junction point, or symbolic link, linked to a directory that had already been scanned because of another junction point or symbolic link, whereas newer versions check every time a directory is scanned and not just when it is a link. |
All Content: 2BrightSparks Pte Ltd © 2003-2024