{"id":288,"date":"2005-06-20T15:32:44","date_gmt":"2005-06-20T21:32:44","guid":{"rendered":"http:\/\/jameskovacs.com\/2005\/06\/20\/Junctions+Feel+The+Symlink+Love"},"modified":"2005-06-20T15:32:44","modified_gmt":"2005-06-20T21:32:44","slug":"junctions-feel-the-symlink-love","status":"publish","type":"post","link":"https:\/\/www.jameskovacs.com\/index.php\/2005\/06\/20\/junctions-feel-the-symlink-love\/","title":{"rendered":"Junctions: Feel the Symlink Love"},"content":{"rendered":"<p><P>Back when I was using BSD Unix and Linux a lot, sym links were incredibly handy creatures. It was with great joy that I recently discovered NTFS Junctions (aka Reparse Points), which are directory-only&nbsp;sym links for NTFS file systems. Junctions are supported in NTFS on Windows&nbsp;2000, Windows XP, and Windows 2003 Server. Out-of-the-box, Junctions are not easy to use, but two little utilities make life much easier:<\/P><br \/>\n<UL><br \/>\n<LI><A href=\"http:\/\/www.sysinternals.com\/Utilities\/Junction.html\">Junction<\/A> &#8211; A sysinternals command-line utility for creating, viewing, and deleting junctions.<br \/>\n<LI><A href=\"http:\/\/www.paraesthesia.com\/blog\/comments.php?id=801_0_1_0_C\">Junction Icon Overlay<\/A> &#8211; Windows Explorer Overlay that displays a junction icon on sym linked folders.<\/LI><\/UL><br \/>\n<P>Now you might be wondering, what the heck are sym links\/junctions\/reparse points and why should I care? Let&#8217;s take my current setup as an example. I&#8217;ve got a pile of virtual machines for running the latest Visual Studio 2005 and SQL Server 2005 bits, along with installs for Indigo, Avalon, and WinFX. My laptop hard drive, while a spacious 60 GB, fills up rather quickly with all those VHD files. Now I could put all the VHDs on my 300 GB Maxtor external drive, but what happens when I need to use one on the road. (The&nbsp;Maxtor external drive&nbsp;requires an external power supply. So you can&#8217;t fire it up when you&#8217;re commuting on the bus.) I could copy it over to the internal drive, but then I have to tidy up my delete\/re-create the virtual machine in the VPC 2004 console. Instead I junction the virtual machine directory on my external drive to &#8220;My Documents\\My Virtual Machines&#8221;. Here is my external drive:<\/P><br \/>\n<P><IMG src=\"\/wp-content\/uploads\/MaxtorExternal.png\" border=0><\/P><br \/>\n<P>Here is My Documents\\My Virtual Machines:<\/P><br \/>\n<P><IMG src=\"\/wp-content\/uploads\/MyVirtualMachines.png\" border=0><\/P><br \/>\n<P>The little links on the folders come from the Junction Icon Overlay.<\/P><br \/>\n<P>When I want to create a new virtual machine on the external drive, for example Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1:<\/P><br \/>\n<OL><br \/>\n<LI>Create an empty directory called R:\\My Virtual Hard Disks\\Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1.<br \/>\n<LI>Open a command prompt in C:\\Documents and Settings\\JamesK\\My Documents\\My Virtual Machines\\.<br \/>\n<LI>Run the command: junction &#8220;Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1&#8221; &#8220;R:\\My Virtual Hard Disks\\Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1&#8221;.<br \/>\n<LI>Create the new virtual machine using the Virtual Disk Wizard and Virtual Machine Wizard as per normal using the path &#8220;C:\\Documents and Settings\\JamesK\\My Documents\\My Virtual Machines\\Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1&#8221;.<\/LI><\/OL><br \/>\n<P>This has a number of advantages over just creating the virtual machine on the external drive:<\/P><br \/>\n<UL><br \/>\n<LI>If I ever want to make that virtual machine portable, I simply delete the junction (junction -d &#8220;Windows&nbsp;XP Pro&nbsp;&#8211; Whidbey RC1&#8221;) and copy the directory over to the same place. VPC 2004 will never be the wiser.<br \/>\n<LI>If I decide to archive an old virtual machine on the internal drive because a new beta drop just hit the streets, I copy it to the external drive and create a junction.<br \/>\n<LI>If I fire up VPC 2004 without the external drive, only virtual machines on the internal hard drive appear. If I add the external hard drive and restart the VPC 2004 console, the virtual machine images on the external drive appear once again. (Very cool feature. I wonder if the VPC 2004 dev team knows about it.) \ud83d\ude42<br \/>\n<LI>You don&#8217;t have to re-target your&nbsp;differencing VHDs when you move&nbsp;your base VHDs. Just create a junction from the original location to the new location of the base VHDs.<\/LI><\/UL><br \/>\n<P>There are lots of&nbsp;other uses of junctions. Scott Hanselman&#8217;s favourite seems to be <A href=\"http:\/\/www.hanselman.com\/blog\/CheckJunctionsASmallExplorerAddincontextmenuForDiscoveringNTFSReparsePoints.aspx\">avoiding&nbsp;&#8220;the evil that is the Company-Wide Subst&#8221;<\/A>&nbsp;when creating a standard development build tree. (Very good use, I must say.)&nbsp;You could also use them to archive&nbsp;old&nbsp;C:\\Program&nbsp;Files without having to uninstall\/re-install the programs &#8211; simply move the directory to your external drive and create a junction from C:\\Program Files to the new location. Use your imagination and you&#8217;ll be amazed at the uses you can put these little critters to. You&#8217;ll also wonder how you ever lived without them.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back when I was using BSD Unix and Linux a lot, sym links were incredibly handy creatures. It was with great joy that I recently discovered NTFS Junctions (aka Reparse Points), which are directory-only&nbsp;sym links for NTFS file systems. Junctions are supported in NTFS on Windows&nbsp;2000, Windows XP, and Windows 2003 Server. Out-of-the-box, Junctions are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"_links":{"self":[{"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/posts\/288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":0,"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jameskovacs.com\/index.php\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}