Saturday 17 September 2011

Windows 7- Installing on an SSD and another drive

Intro
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.
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion]
"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"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion]
"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\Wow6432Node\Microsoft\WindowsNT\CurrentVersion\ProfileSet]
"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.