{"id":1619,"date":"2014-01-22T18:36:25","date_gmt":"2014-01-22T17:36:25","guid":{"rendered":"http:\/\/michlstechblog.info\/blog\/?p=1619"},"modified":"2014-01-23T14:29:15","modified_gmt":"2014-01-23T13:29:15","slug":"windows-ntfs-symboliclinks-and-hardlinks","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/windows-ntfs-symboliclinks-and-hardlinks\/","title":{"rendered":"Windows: NTFS symbolic links and hard links"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_1619 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_1619')){$('.twoclick_social_bookmarks_post_1619').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Windows%3A%20NTFS%20symbolic%20links%20and%20hard%20links\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0Atoday%20I%20will%20explain%20the%20possiblity%20of%20the%20ntfs%20filesystem%20to%20create%20symbolic-%20and%20hardlinks.%0D%0A%0D%0AWhats%20the%20difference%3F%20A%20symbolic%20link%20%28File%29%20or%20junction%20point%20%28Directory%29%20is%20a%20pointer%20to%20an%20existing%20file%20or%20directory.%20These%20works%20across%20volumes.%0D%0AA%20hardlink%20is%20a%20file%20or%20directory%20which%20is%20referenced%20by%20more%20then%20one%20path%20on%20the%20same%20volume.%0D%0A%0D%0AAn%20example.%20The%20explorer.exe%20in%20c%3A%5Cwindows%20...\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/windows-ntfs-symboliclinks-and-hardlinks\\\/\",\"post_id\":1619,\"post_title_referrer_track\":\"Windows%3A+NTFS+symbolic+links+and+hard+links\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>today I will explain the possiblity of the ntfs filesystem to create symbolic- and hardlinks.<\/p>\n<p>Whats the difference? A symbolic link (File) or junction point (Directory) is a pointer to an existing file or directory. These works across volumes.<br \/>\nA hardlink is a file or directory which is referenced by more then one path on the same volume.<\/p>\n<p>An example. The explorer.exe in c:\\windows. The most Windows system files are hardlinks. These files have two of them. One in the Windows, respective system32 folder and one to its current version in the component store winsxs.<br \/>\n<!--http:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/aa365006%28v=vs.85%29.aspx--><\/p>\n<pre><code>[C:\\]fsutil hardlink list c:\\Windows\\explorer.exe\r\n\\Windows\\explorer.exe\r\n\\Windows\\winsxs\\amd64_microsoft-windows-explorer_31bf3856ad364e35_6.1.7601.17567_none_afa79dc39081d0ba\\explorer.exe<\/code><\/pre>\n<p>this means the file is stored once and there are two references in the filesystem to it.<br \/>\nWith the dir command you cannot identify an hardlink. The only way is fsutil.exe.<\/p>\n<p>Creating an hardlink is very easy.<!--more--> Two builtin command line tools are available since Windows Vista\/Server 2008. mklink.exe or fsutil.exe<\/p>\n<pre><code>[D:\\iso]dir Kal*\r\n Volume in drive D is Data\r\n Volume Serial Number is 7C54-0C6C\r\n\r\n Directory of D:\\iso\r\n20.11.2013  08:35   2.525.937.664  kali-linux-1.0.5-amd64.iso<\/code><\/pre>\n<p>Note: If you are usally working with the penguin OS, the parameters are swapped to the ln command. First the link and then the target.<\/p>\n<pre><code>D:\\iso&gt;mklink \/h d:\\iso\\Kali-Linux-current.iso d:\\iso\\kali-linux-1.0.5-amd64.iso\r\nHardlink created for d:\\iso\\Kali-Linux-current.iso &lt;&lt;===&gt;&gt; d:\\iso\\kali-linux-1.0.5-amd64.iso<\/code><\/pre>\n<p>or<\/p>\n<pre><code>D:\\iso&gt;fsutil hardlink create d:\\iso\\Kali-Linux-current.iso d:\\iso\\kali-linux-1.0.5-amd64.iso\r\nHardlink created for d:\\iso\\Kali-Linux-current.iso &lt;&lt;===&gt;&gt; d:\\iso\\kali-linux-1.0.5-amd64.iso<\/code><\/pre>\n<p>it seems there are 2 files, each with a size of 2.3GB. But in fact the file is stored only once!<\/p>\n<pre><code>[D:\\iso]dir Kal*\r\n Volume in drive D is Data\r\n Volume Serial Number is 7C54-0C6C\r\n\r\n Directory of D:\\iso\r\n20.11.2013  08:35   2.525.937.664  kali-linux-1.0.5-amd64.iso\r\n20.11.2013  08:35   2.525.937.664  Kali-Linux-current.iso<\/code><\/pre>\n<p>Deleting the hardlink<\/p>\n<pre><code>[D:\\iso]del Kali-Linux-current.iso<\/code><\/pre>\n<p>Also the creation of a symbolic link is very easy. You can use the builtin command mklink.exe or junction.exe (Folders only) delivered by the sysinternals tool suite.<\/p>\n<pre><code>D:\\iso&gt;mklink  d:\\iso\\Kali-Linux-current.iso d:\\iso\\kali-linux-1.0.5-amd64.iso\r\nsymbolic link created for d:\\iso\\Kali-Linux-current.iso &lt;&lt;===&gt;&gt; d:\\iso\\kali-linux-1.0.5-amd64.iso<\/code>\r\n<code>D:\\iso&gt;dir Ka*\r\n Volume in drive D is Data\r\n Volume Serial Number is 7C54-0C6C\r\n\r\n Directory of D:\\iso\r\n\r\n20.11.2013  08:35       2.525.937.664  kali-linux-1.0.5-amd64.iso\r\n22.01.2014  22:57             Kali-Linux-current.iso [d:\\iso\\kali-linux-1.0.5-amd64.iso]<\/code><\/pre>\n<p>The behaviour of how symlinks are evaluated can altered by<\/p>\n<pre><code>D:\\iso&gt;fsutil behavior set SymlinkEvaluation<\/code><\/pre>\n<p>This lists the current settings<\/p>\n<pre><code>D:\\iso&gt;fsutil behavior query SymlinkEvaluation\r\nLocal to local symbolic links are enabled.\r\nLocal to remote symbolic links are enabled.\r\nRemote to local symbolic links are disabled.\r\nRemote to remote symbolic links are disabled.<\/code><\/pre>\n<p>If the powershell is your favourite environment, then the &#8220;Powershell community extensions&#8221; provides some command-lets for the handling of hard- and symlinks:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nGet-ReparsePoint\r\nNew-Hardlink\r\nNew-Junction\r\nRemove-ReparsePoint\r\nNew-Symlink\r\n<\/pre>\n<p>Get it from <a title=\"Powershell Community Extension\" href=\"http:\/\/pscx.codeplex.com\">http:\/\/pscx.codeplex.com\/<\/a>.<\/p>\n<p>Have a nice day.<\/p>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, today I will explain the possiblity of the ntfs filesystem to create symbolic- and hardlinks. Whats the difference? A symbolic link (File) or junction point (Directory) is a pointer to an existing file or directory. These works across volumes. A hardlink is a file or directory which is referenced by more then one path &hellip; <a href=\"https:\/\/michlstechblog.info\/blog\/windows-ntfs-symboliclinks-and-hardlinks\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Windows: NTFS symbolic links and hard links<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5],"tags":[411,414,410,409,413,412,20],"class_list":["post-1619","post","type-post","status-publish","format-standard","hentry","category-windows","category-windowsknowhow","tag-create-hardlink","tag-create-junction","tag-create-reparsepoint","tag-create-symlink","tag-fsutil","tag-mklink","tag-windows-2"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=1619"}],"version-history":[{"count":9,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1619\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/1619\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=1619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=1619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=1619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}