Creating NTFS Symbolic Links from Linux for Windows Compatibility: A Technical Guide


4 views

When working with dual-boot systems, we often need to manipulate Windows filesystems from Linux. A common scenario is relocating system folders that are locked during Windows operation. While Linux's native symlinks work great on ext4, they don't translate well to NTFS.

Before proceeding, ensure you have:

sudo apt-get install ntfs-3g

This provides NTFS read/write support in Linux.

The ntfs-3g driver includes a utility called winln specifically for creating Windows-compatible symbolic links:

sudo winln -s /media/ntfs_partition/original_folder /media/ntfs_partition/new_link

For absolute paths (recommended for system folders):

sudo winln -s "C:\\Program Files\\Original" "D:\\NewLocation\\Link"

After creating the link, verify it works in Windows:

dir /AL

This lists all symbolic links in the current directory.

For systems without winln, you can use this Python script:


#!/usr/bin/python3
import sys
import os

def create_ntfs_link(source, target):
    os.symlink(source, target, target_is_directory=True)

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: mkntfslink source target")
        sys.exit(1)
    create_ntfs_link(sys.argv[1], sys.argv[2])
  • Always unmount the NTFS partition cleanly (sudo umount)
  • Links created this way appear identical to native Windows symlinks
  • For system folders, you may need to take ownership in Windows first

Moving the Windows Users folder requires:

sudo winln -s "D:\\Users" "C:\\Users"

Then update the registry in Windows to point to the new location.


When working with dual-boot systems, you might need to create Windows-compatible NTFS symbolic links from Linux. The core requirement is creating links that:

  • Persist across reboots
  • Are recognized by Windows 7+
  • Maintain proper file system permissions

Before proceeding, ensure your Linux system has:


# Check NTFS-3G version (should be 2017.3.23 or later)
ntfs-3g --version

# Required packages for Ubuntu/Debian
sudo apt-get install ntfs-3g attr

The ntfs-3g driver with windows_names mount option is essential:


# Example mount command with proper options
sudo mount -t ntfs-3g -o windows_names /dev/sda1 /mnt/windows

For creating actual symlinks, use the ln command with specific attributes:


# Create directory symlink (similar to Windows junction)
sudo ln -s /mnt/windows/actual_folder /mnt/windows/link_folder

# Set DOS attribute to mark as system file (important for Windows)
sudo setfattr -n user.DOSATTRIB -v 0x16 /mnt/windows/link_folder

For more complex situations like relative paths or different drive letters:


# Create relative symlink (Windows 10+ compatible)
sudo ln -s -r ../target_folder ./link_folder

# Cross-drive links require absolute paths
sudo ln -s /mnt/windows_d/SharedData /mnt/windows_c/Users/Public/SharedData

After creating links, verify them in Windows and check for common issues:

  • Ensure both source and target have proper permissions
  • Check if symlink was created with proper DOS attributes
  • Verify the NTFS partition was mounted with windows_names option