Using sys internals Junction to link software and multiple OS installs 

For various reasons ( 8GB RAM and badly behaved software, or lazy software companies that don’t make 64 bit drivers) I run Vista 64 and the Windows 7 32 eval, i have them on different partitions ( Though I didn’t have to install an XP build since the Virtual XP in 7 seems to work pretty well, which is good because its a bit of a hassle to install XP after vista/7 are installed )

First I’d setup a new machine with each of the OS’es and set about installing a copy of the software I use to each of them, then installed the patches and so on and so forth, very time consuming.

Then i wondered about using junctions (soft links) to the different software on each OS install, obviously it won’t work on software that has native 64/32 versions that only install one or the other, but it I tried it with VC2008 SP1 and it works just fine.

1. Install and Patch VC2008 on both OS’es using same setup.

2. Install junction and handle the EULA.

3. Boot into the OS you want the Junction to be hosted from, the original copy. Especially in the case of VC that runs all sorts of processes from its directory, so you cant rename it.

4. Rename the Target Directory to something else (later to delete).
   i.e.. “Microsoft Visual Studio 9.0” to “_Microsoft Visual Studio 9.0” or such.

5. Pop into the command shell and create a junction
   junction “D:\Program Files\Microsoft Visual Studio 9.0” “C:\Program Files(x86)\Microsoft Visual Studio 9.0”

For your OS it might be a different path, especially if you aren’t using a 64 bit OS. Junction is <target> <source>

Reboot into the other OS and try it out.

I also tried it with my new blog and windows live editor, since i have it installed in two OS’s. I only see the previous posts on the OS i created them on, so to solve it I created a junction from

“c:\Users\charlie\Documents\My Weblog Posts”

to

“D:\Users\charlie\Documents\My Weblog Posts”

removing the latter directory first as well as using your username path.

When I ran the Live Editor , the old posts did not show. I found though if you save a draft, they all magically appear. I actually just went to the above folder and double clicked an old post, and then saved a draft, but either ought to work.

Junctions are a lot like soft links in Un*x and can very useful, Windows does make it a bit harder on us since so many programs store odd information in the program folders, you might also get issues with the long type identifiers for drive paths, though that would be rare.

To determine if a program folder was suitable to do a junction with, i did a directory compare with the awesome Beyond  Compare, change it to a binary comparison first, some files will likely be different, cache files, rebased dll’s etc but nothing i could find that mattered, i always have UAC off so security so far hasn’t been an issue.

You potentially run into issues when you’re running an update on a program that puts things in other folders, i.e. the windows folder, since it’ll be  out of sync, to be sure break the junction, copy or rename the old folder if you kept it around and then install all the patches to be sure. A lot of updates just overwrite the files again anyway, so its often OK to just run the update twice in each OS.

Be careful with some folders as it’ll royally screw up windows if you pick the wrong one, but it’ll work for most of the My Documents folders, just watch out for some of the hidden application ones.

Pity it won’t work for everything, but my hope is that Windows 7 64 with a virtual XP inside it will solve all my problems and I’ll only need one copy of everything.

There are a couple of problems with the Live Blog Editor and this method, i think its using the cache files to link new posts against old edited ones, so if i edit a post from the other OS and then publish it, it’ll make a completely new entry, which is annoying, hopefully I’ll find a way around it *1

 

*1 And i did, click the ‘More..’ then switch to editing articles via the blog itself, rather than use the Recently Posted, this somewhat defeats the purpose of using a combined data folder. But once you’ve edited it once it seems to fix itself.