Windows Hard Link [better]
When using WSL, files stored in \\wsl$\ are actually on a virtual filesystem. Hard links don't work across the Linux/Windows boundary, but within a Windows NTFS drive, hard links are fully supported. Useful for deduplicating build artifacts between WSL and native Windows tools.
MFT (Master File Table) entry, they are indistinguishable to the operating system. If you modify the file using the original name, the changes appear instantly when you open it via the hard link. This is because they are literally the same bits on the disk. The file is only truly deleted when the last hard link to it is removed; the system keeps a "link count," and only when that count hits zero is the disk space marked as free. Key Characteristics and Limitations Hard links have specific rules that differentiate them from "Shortcuts" or "Symbolic Links": Same Partition Only: A hard link must reside on the same partition (volume) as the original data. You cannot hard link a file from your C: drive to your D: drive. Files Only: In Windows, you cannot create a hard link for a folder (for that, you would use a Directory Junction). Zero Extra Space: Since the data isn't being duplicated, a hard link takes up almost no additional disk space. Transparent to Apps: Most software cannot tell the difference between a hard link and the original file. This makes them incredibly stable for system configurations. Practical Use Cases The most common use of hard links is found within Windows itself. The
A copy is two independent files. Change one, the other stays old. A hard link is one file with two names. windows hard link
Think of a file on your hard drive as a person and a "hard link" as a name badge. A person can wear multiple name badges—"John," "Manager," and "Dad"—but they are still just one person.
A hard link doesn't point to a path —it points directly to the raw data on disk. That data has no location except "wherever Windows put it." When using WSL, files stored in \\wsl$\ are
Or with the shorter alias:
Workaround: Use directory junctions or symlinks with mklink /D or mklink /J . MFT (Master File Table) entry, they are indistinguishable
| Operation | Disk Space | Sync Behavior | Time to Create | |-----------|-----------|---------------|----------------| | Copy file | Double | No sync after copy | Slow (reads/writes all bytes) | | Hard link | Zero extra | Always in sync | Instant |
(Get-Item "file.txt").LinkCount