Monday, June 13, 2011

Finished Just In Time For Classes Today

I set myself up a nice little project late last week through the weekend, though I just finished up this morning. I decided to repartition my hard drives, reorganize my Users and Program Files and do a Windows reinstall. I can’t figure out for the life of me why Microsoft makes it so damn difficult to move the User directories, Program Files, and ProgramData to different partitions/hard drives.

Anyways, pretty much most of Thursday was spent planning and partitioning my drive. I actually used Ubuntu flavored Linux and Gparted for the partitioning. While it may be a bit on the slow side, it does an excellent job for partitioning and resizing.

Friday was a day for the Windows 7 reinstall, getting all of the updates, and trying to get everything moved to their new home. To get everything moved, I used the command line robocopy to get a copy of everything in its new home. Actually, the first time I tried to copy the User directory I had forgotten to use the /R: and the /W: to limit the number of Retries and to reset the Wait time between retries for files that were in-use at the time. I set the number of retries to five and reduced the wait to 10 seconds. Those setting worked out pretty well.

After that it was into the registry to change the “Default” locations. I put default in quotes because any program that gets installed, or keeps files/data in either the ProgramData or User folders should look to the registry for the default locations. Sadly, most of them are hard coded to go to C:\Folder. What this means is that if you install a program and you have moved your Program Files to D:\, about half of your programs (if you are lucky) will install to D:\Program Files automatically, the rest will try to install to C:\Program Files and you will have to make the change manually.

I know from previous experience what this results in. Months later you go to install a new program, it defaults to C:\Folder, you forget to make the change, and now you have Program Files, ProgramData, and possibly even new User folders on your C:\ drive. Now try getting that mess together the next time you want to reinstall or Windows 8 comes out.

Enter symbolic links to save the day. Using the command line to set up a junction to the directory, you can fool programs into using the proper folders. The command looks like this:

mklink /J “C:\Folder” “D:\Folder”

What this does is put what is essentially a shortcut on C:\ to your D:\Folder. So on your C:\ drive you have C:\Folder which is nothing more than a shortcut to D:\Folder. This makes life much easier as now everything can look to the C:\ drive (if it wishes) and will be redirected automatically to the correct location.

Of course, if it were only actually that easy, right? In order to set up the symbolic links, the folders can only exist in one place. So after you copy your User, Program Files, and ProgramData directories to their new home, you have to delete the original folders before the links can be made. Let me tell you that ProgramData folder was a pain. There were two offending programs that did not look to the registry, but went automatically to C:\ProgramData. Those two programs were my VLC player and Microsoft Security Essentials. I would call MSE the worst offender, as it was not obvious what the offending program actually was (it took me awhile to track down that it was actually MSE that was writing to these folders).

However, once I tracked down which programs were causing my headaches, all I had to do was uninstall them, delete the C:\ProgramData folder, create the symbolic links, then reinstall the programs. All in all, it was not that bad a way to spend the weekend.