My Technical Notes

Wednesday, 31 May 2017

Symbolic Link Types in Windows

Here is a summary of the different types of symbolic links in Windows:

  • Hard Link
    • Acts on files.
    • Can only operate within the same volume.
    • A hard link to a file is exactly the same as the target you created it from. Therefore if you deleted the target, the file can still be accessed from the hard link. Once all hard links are deleted (including the original target), then the file itself will be deleted.
    • Created using the `/H` flag of `mklink`.
  • File Symbolic Link
    • Acts on files.
    • By default, requires admin rights.
    • It can be deleted without affecting the original.
    • Can span volumes, therefore a link in your C drive can reference a network file.
    • Without specifying a flag, by default, this is what `mklink` creates.
  • Directory Symbolic Link
    • Acts on directories.
    • By default, requires admin rights.
    • On a local volume, it can refer to a remote directory.
    • Processed on the client, so the client will interpret the link and redirect itself. Therefore if the server's link refers to a local directory, `C:\local\`, then the client will interpret it as his own `C:\local\` directory, not the server's.
    • Created using the `/D` flag of `mklink`.
  • Directory Junction
    • Acts on directories.
    • It can only refer to local NTFS volumes (therefore cannot reference a remote location).
    • Processed on the server, therefore the server will redirect. Therefore if the server's link refers to `C:\local\`, then the client will correctly be served content from the server's `C:\local\`, not his own, as would be the case with a directory symbolic link.

No comments: