Saturday, 17 September 2011

Windows 7- Installing on an SSD and another drive

More and more of us are buying SSDs to use in our computers due to their faster speeds, however you may not want to shell out a lot of money to get one of a decent size. This leaves you with the possibility of installing your OS on the SSD and use another (mechanical) drive for everything else, such as your files.
While this does work, I do not want to have to worry about which drive my program is going to install on, or where a picture is going to be saved. I want to run through an installer and not have to change anything, the same for saving documents. I want it all to be in the correct place.

Today I'm using Windows 7 x64 and a 60GB SSD, so all of the following is aimed at that. If you use x32, you are in luck, everything is the same and just miss out the commands that differentiate between 32 and 64 bit. If you still use Vista, everything should still apply.

I ventured online looking for some answers, most of which provided some registry changes to fool Windows as to where the users folder is located. The same for Program Files.

I then found a guide that allowed you to enter Command Prompt during a Windows install and make the changes there. However, they were a bit vague when it came to x64 installations and if you missed out a command, you may find yourself not being able to logon.

After about 5 or so attempts at installing Windows, I finally cracked it. I now have Windows on my SSD and users and program files on my Caviar Black. My SSD is drive C and my mechanical drive is D.

The Installation Changes
After Windows has copied all the files to disk you are prompted to restart. You are then greeted with a welcome screen where you can create a user account. At this point, press Shift + F10 to bring up a Command Prompt.

You then have 3 commands to enter. The first simply copies 1 directory to another. In this case, the users folder on the SSD to the mechanical drive. The second command removes the folder from the SSD and the final command creates a symbolic link between the two- so if anything tries to access C:\Users, it will actually be accessing D:\Users.
robocopy "C:\Users" "D:\Users" /E /COPYALL /XJ
rmdir "C:\users" /S /Q
mklink /J "C:\users" "D:\users"

These 3 commands can be repeated for the Program Files folder and if you're using x64, Program Files (x86).
robocopy "C:\Program Files" "D:\Program Files" /E /COPYALL /XJ
rmdir "C:\Program Files" /S /Q
mklink /J "C:\Program Files" "D:\Program Files"

robocopy "C:\Program Files (x86)" "D:\Program Files (x86)" /E /COPYALL /XJ
rmdir "C:\Program Files (x86)" /S /Q
mklink /J "C:\Program Files (x86)" "D:\Program Files (x86)"
You have now successfully moved the files on disk, but according to Windows, they are still in the old locations. We now need to adjust the registry. In the Command Prompt, enter "regedit" to open Windows Registry Editor.

Go to the following locations, and replace 'D' with the letter of your mechanical drive.
"CommonFilesDir" = "D:\Program Files\Common Files"
"CommonFilesDir (x86)" = "D:\Program Files (x86)\Common Files"
"CommonW6432Dir" = "D:\Program Files\Common Files"
"ProgramFilesDir" = "D:\Program Files"
"ProgramFilesDir (x86)" = "D:\Program Files (X86)"
"ProgramW6432Dir" = "D:\Program Files"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\ProfileList]
"Default" = "D:\Users\Default"
"ProfilesDirectory" = "D:\Users"
"Public" = "D:\Users\Public"

"CommonFilesDir" = "D:\Program Files\Common Files"
"CommonFilesDir (x86)" = "D:\Program Files (x86)\Common Files"
"CommonW6432Dir" = "D:\Program Files\Common Files"
"ProgramFilesDir" = "D:\Program Files"
"ProgramFilesDir (x86)" = "D:\Program Files (X86)"
"ProgramW6432Dir" = "D:\Program Files"

"Default" = "D:\Users\Default"
"ProfilesDirectory" = "D:\Users"

Once this is complete, exit the registry editor and the command prompt. You can now continue through the wizard to create your user account on drive D.
Once you're logged in, when you come to install a program it will be installed on drive D.
If you take a look on C:, you will see the symbolic links between the folders on the 2 drives.

The only things left on your SSD will be the Windows folder. I still have about 30GB free space, which I can use for caches etc, such as the Adobe Creative Suite cache.

Some of you may ask why have I moved the Program Files off of the SSD. Well, I have a relatively small SSD and don't want to have to think about whether this program should go on the SSD or elsewhere. Furthermore, most program .exe's are relatively small, so whether the amount of time saved by putting them on an SSD is questionable.

And finally, the changes for the registry can probably be put into a .reg file so you don't have to type them yourself. But after 5 failed installations, I was not in the mood to work this out.


Jonny Simmonds said...

I have just finished following this guide to set up a similar system. Very good guide, really helped not having to trawl the internet and try the things out 1 by 1. All in all it took me 3 attempts to get mine the way I wanted.

I did find, in following the guide, a few corrections to be made:
1) The shortcut to bring up a Command Prompt during install is Shift + F10, not Shift + F3 (Shift + Ctrl + F3 takes you into Audit Mode to configure a PC before any user accounts are added, however this is not what is required here).
2) The registry edit for CommonFilesDir (x86) (for both occurances) should be the following:
"CommonFilesDir (x86)" = "D:\Program Files (x86)\Common Files"

One thing that should also be noted is that robocopy is slow, which is not a problem, but also appears to hang while it is working (i.e. not reporting progress). For reference the copying of Program Files takes ~5 minutes.

I have set my system up as described in the post and additionally added a "SSD Program Files" directory on the SSD to store larger programs which would be sped up by it (e.g. Photoshop). This means the default location (which some smaller programs don't offer an alternative for) is on the mechanical, whereas I can optionally set for more advanced programs to go on the SSD.
The disadvantage of the method described in the post is that the two disks must always be linked; you cannot move them separately (i.e. the SSD will not boot without the mechanical present).

Alex Sheppard said...

Thanks Johnny, I've fixed those couple of things.

Robocopy for me was pretty speedy, it must have taken 10seconds at most and showed the directories as it copied them.