MKLINK Symlinks and Hardlinks aka Junctions

 

OK,

For the ones like me who use this command oh-not-so-often and keep forgetting the principles:

MKLINK and the difference between /D & /J, aka directory symbolic links and directory hard links

MKLINK parameters overview

 

File

Folder

Symbolic Link

 

/D

Hard Link

/H

/J

 

Difference* between symlink vs. hardlink/junction in terms of remote/network shares; symlinks allow to reference remote resources, but are relative to the client. Meaning:

Link

Target

Local Computer (Alice)

Remote Computer (Bob)**

Symbolic Link

Local

C:\symlnk –> C:\target

\\Alice\C$\symlnk –> \\Bob\C$\target

Remote

C:\symlnk –> \\server\target

\\Alice\C$\symlnk –> \\server\target

Hard Link

Local

C:\hrdlnk –> C:\target

\\Alice\C$\hrdlnk –> \\Alice\C$\target

Remote

n/a

n/a

 

As depicted above, /J and /H to remote share are not possible.

Note that the in first row \\Bob\C$\target is representing the really followed path. The virtually represented path still shows \\Alice\C$\symlnk etc. Also remember that although the symlink from Bob’s perspective is “misbehaving” this could be a useful side effect for enterprises with a set of default local folders policy: for example this is a nice way to forward to \\server\share\team\user\temp folder to a local temp folder.

*: here simply my systemized version from this website

**: you cannot follow remote symlinks because of a security consideration but you can disable it using the following command:

fsutil behavior set SymlinkEvaluation R2L:1 R2R:1

For more info look here

Advertisements

One thought on “MKLINK Symlinks and Hardlinks aka Junctions

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s