Symlinks, Hardlinks, etc. in Server 2008 R2 x64 VDS

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
Patriot
A regular
A regular
Posts: 40
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Jan 15, 2012 12:10 pm

Symlinks, Hardlinks, etc. in Server 2008 R2 x64 VDS

Post by Patriot »

Hello Fellow VDS-ers,

What is the recommended linking methodology (Symlink, Hardlink, Junction, etc.) in order to allow a single copy of a commonly used file or directory to be used in multiple locations?

Second, if linking a complete folder structure at the topmost parent folder, will a link or Junction allow all of the sub-folders to be accessed as if they were located in the destination directory?

Third, do the links allow multiple concurrent reads of the target files and/or directories, and if so, is there a practical limit?

Best regards,

Patriot
Patriot
A regular
A regular
Posts: 40
Joined: Sun Jan 15, 2012 12:10 pm

Re: Symlinks, Hardlinks, etc. in Server 2008 R2 x64 VDS

Post by Patriot »

After doing some additional research, I found some key differences between Symbolic links (symlinks) and Hard Links (hardlinks) in Windows:

Symbolic link:
  • Can point to either a file OR a directory on the same or a different drive
  • Created as mklink link_name target_name (in command prompt)
  • The icon next to the link is the same like that of a shortcut
  • Occupies zero space in the system
  • It is not a separate file in the file system
  • Interpreted at the operating system level
  • If the original file is deleted, the link is useless
  • Removing the original file does not remove the symbolic link
  • Removing the symbolic link does not remove the original file
Hard link:
  • Can only point to a file on the same drive, but not a directory
  • Created as mklink /H link_name target_name (in command prompt)
  • The space it occupies equals the size of the original file, but refers to the same object in the
  • system (not a copy)
  • Interpreted at the operating system level
  • The icon next to the hard link is different from the other objects
  • Removing the original file does not remove the hard link
  • Removing the hard link does not remove the original file
  • If the original file is deleted, its content is still available through the hard link
  • Making a change to the hard link propagates all changes to the original file
Creating links is a pain using a command prompt, unless you are an old DOS geek :D Fortunately, there is a utility that adds linking functionality to the Windows Explorer context menu:

1. Link Shell Extension by Hermann Schinagl
2. requires Microsoft Visual C++ 2005 redistributable be installed

Best regards,

Patriot
Patriot
A regular
A regular
Posts: 40
Joined: Sun Jan 15, 2012 12:10 pm

Re: Symlinks, Hardlinks, etc. in Server 2008 R2 x64 VDS

Post by Patriot »

*This should have been added to the previous post, but I cannot edit it.*

Junction:
  • Can point only to a folder or a directory on either the same or a different drive (think of it as a hard link for folders)
  • Created as mklink /j link_name target_name (in command prompt)
  • Has the same size as the target without duplicating it (doesn’t use any space)
  • Interpreted at the operating system level
  • The icon next to the junction is different from the other objects
  • Removing the target folder does not remove the junction
  • Removing the junction does not remove the target folder
  • If the original folder is deleted, the junction still exists but points to a non-existent folder
  • Making a change to through a junction propagates all changes to the original folder
An application of linking (sym, hard, or junction) on a game server could include storing a single set of custom maps that are accessed via links by multiple game servers on the same or a different drive. Benefits of this approach:

1. Version control - you have only one set of custom map files to maintain that are shared across multiple game servers, and any changes to the original files are automatically propagated via the links.
2. Read speed - if the custom map files are large and stored on a high speed drive or an SSD, you could potentially increase the data throughput during heavy file read activity.
3. Conservation of disk space - not a huge benefit given the size of most drives these days, but if using a smaller drive it is helpful.

Best regards,

Patriot
Post Reply