Using hard links of files and directories, it is possible to have several different file or directory names referring to the same data. In windows, the mechanism works on the NTFS file system. An article on how to make such links in windows.
You may have faced the following tasks:
- Install an application or game on the HDD, and transfer part to the SSD.
- Drag and drop application data without editing the configuration. (example below for SQL Server)
- The application/data doesn’t fit on one drive, and the other drive just has free space for the rest.
Create a symbolic link
The command is used to create a link mklink
(from command line cmd
, cap).
mklink
Создает символьную ссылку.
MKLINK [[/D] | [/H] | [/J]] Ссылка Назначение /D Создает символьную ссылку на каталог. По умолчанию создается символьная ссылка на файл. /H Создает жесткую связь вместо символьной ссылки. /J Создает соединение для каталога. Ссылка Указывает имя новой символьной ссылки. Назначение Указывает путь (относительный или абсолютный), на который ссылается новая ссылка. I recently wanted to delete the Microsoft SQL Server update cache folder to free up 2 GB on the system SSD drive. Instead of deleting, I moved the data to another drive (D:). I created a symbolic link and, voila, the place is freed, and SQL Server thinks that the data is still in place.
C:\>mklink /D "c:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache" "d:\distr\Sql Server\Update Cache"
Символическая ссылка создана для c:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Update Cache <<===>> d:\distr\Sql Server\Update Cache There are tools for creating links through the GUI, for example Link Shell Extension
or NTFS Link
, they can also be easily made in Far using Alt+F6
Differences between hard links and symbolic links and links
Reference material Far Manager
.
You can create hard links on NTFS partitions
(HardLink) for files, links
(Junction) for folders and symbolic links
(SymLink) for files and folders using the Alt-F6 command.
Hard links
A Hard Link is just another folder entry for a given file.
When a hard link is created, the file itself is not physically copied, but only appears under another name or in another location, and its old name and location remain intact. From now on, the hard link is indistinguishable
from the original entry in the folder. The only difference is that no short file name is created for a hard link, so it is not visible from DOS programs.
When the size or date of a file changes, all related folder entries are updated automatically. When a file is deleted, it is not physically deleted until all hard links pointing to it have been removed. The order in which they are removed does not matter. When you delete a hard link to the trash, the number of links in the file is preserved.
FAR can create hard links, display their number for each file in a separate column (by default, this is the last column in the 9th panel mode), and sort files by the number of hard links.
Hard links can only be created on the same drive as the source file.
Connections
This technology allows you to map any local folders to any other local folders. For example, if the folder D:\SYMLINK points to C:\WINNT\SYSTEM32 as its target, then a program accessing D:\SYMLINK\DRIVERS will actually access C:\WINNT\SYSTEM32\DRIVERS. Unlike hard links, folder links do not have to be on the same drive.
In Windows 2000, it is not possible to directly create a link pointing to a CD-ROM folder, but this limitation can be circumvented by mounting the CD-ROM disk to a folder on an NTFS partition.
Symbolic links
Symbolic links (SymLink) to NTFS are supported starting from Windows Vista (NT 6.0). They are an improved version of directory links – symbolic links can point to both folders and files, both local and network, while relative paths are supported.
UPD PowerShell
Creating a symbolic link with New-Item
New-Item -Path C:\LinkDir -ItemType SymbolicLink -Value F:\RealDir Move PostgreSQL databases to another Windows drive
If you have Postgres installed in the default configuration, then its databases are stored in Program Files. If there is a need to free up space on the system drive C, then you can move the Postgres databases to another drive.
How to update npm and npm packages?
npm update via npm + package update command using angular cli example (globally).
Cannot start virtual machine on Virtualbox
When informing Raw-mode is unavailable courtesy of Hyper-V. (VERR_SUPDRV_NO_RAW_MODE_HYPER_V_ROOT).
disable Windows component – Hyper-V
and reboot.
Add to PATH (environment)
Add folder to PATH environment variable for current session
Open Windows Terminal in current folder
Add setting "startingDirectory": "."
in terminal profile CTRL + ,
Windows. Docker cannot occupy a free port
net stop winnat
docker start ...
net start winnat Linux and FreeBSD
Creation
ln -s
On Linux based systems (e.g. Ubuntu or CentOS
) and FreeBSD
symlink for directory and file are created the same way:
Deletion
One command is also used:
How to create and delete symlinks
Terms used: Symlink
, Windows
, Linux
.
Windows
Linux
Problems and Solutions
Working with symbolic links in Windows is done from the command line.
Syntax
mklink
Symlink to file
* in this example on the user’s desktop dmosk
a symlink will be created to the file cmd.exe
.
Symlink to directory
Key /J is also available to create a link to a folder
. A link created in this way will in some ways resemble a hard link
.
Remove symlink
In Windows, it can be deleted in Explorer like a regular file or folder.
Or use the command line.
Allow symlinks in Windows
If, when trying to follow a symbolic link, we get the error “The symbolic link cannot be loaded because its type is disabled”, open the command prompt as an administrator and enter the command:
fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
If that doesn’t help, try creating a symlink with the /J key.
Solving possible problems
When working with symlinks, we may encounter various problems. I’ll take a look at the ones I’ve come across.
ln: failed to create symbolic link . Function not implemented
When trying to create a symlink, we may get an error Function not implemented
, for example:
ln: failed to create symbolic link ‘/etc/pve/nodes/pve/fullchain.pem’: Function not implemented
Reason:
the file system on which we want to create the file does not support symlinks. You can view the file system of mounted partitions with the command:
Solution:
in general, the solution depends on the file system being used and its driver. But, usually, there is no solution to the problem and you need to look for ways to work without using symbolic links.

Was this guide helpful to you?



