Separate User & Windows Directory On Different Drives

Overview

I wanted to have the Windows partition and the user partition on separate drives. I have done this in the past on a Linux computer and it was very painless.

The advantage to this setup is that most of the personal data such as things stored in My Documents, My Music, etc and the Windows specific stuff like installed programs, patches, etc are stored on a separate partition whether it’s on the same or different drive. This degree of separation allows the Windows partition to be wiped and started fresh without affecting the personal files.

I had time during my fresh install to play about with various setups and have listed the options in the following section.

Be aware that not all programs store settings/preferences in the user directory so this is no replacement

I am not responsible for any damage or problems caused by the below procedure.

Final note is that I tried many combinations but some how managed to get it to work. Whilst the steps may not be 100% correct it should be a good guideline to see the process through. I shall update it should I come across it again.

Prerequisites

Before starting ALWAYS ALWAYS back up all the necessary files. Even though this design is suppose to negate the need to back it is still advised to backup in case something goes wrong.

Have a Windows 7 Install CD and CD Key ready.

Time!

Mounting Options

  1. Mounting a drive to a directory – I was very keen on using this technique when I saw in the Disk Management utility. It sounds like the method used in Linux and would make it fairly transparent to the user.
  2. Separate sub directories within users – This option makes it very simple to do because Windows 7 has the option of moving all the directories under the users one such as Pictures, Music, Search, etc. Just specify the new location and Explorer will move the files creating the directory along the way and taking care of permissions.
  3. Change the %UserProfile% in the registry so that it is pointing to another drive.

Mounting A Drive To A Directory

This was my first choice so I wiped my system and went about to do this. The steps described in the superuser website are as follows:

1. You boot with the install media.
2. At the screen with the “Install Now” choose “Repair your computer”
3. You will be asked if you want to “Repair and Restart” by the System Recovery options, choose “No”.
4. Then Make sure that Windows 7 is listed as one of the installed OS’s available for recovery, it’s selected and them press next.
5. You will be given a list of recovery tools, chose “Command Prompt”.
6. In the command prompt you will be using Robocopy to copy c:\Users to d:\Users
7. Type robocopy c:\Users d:\Users /mir /xj
8. /mir tells robocopy to mirror the directories, this will copy all files and permissions.
9. /xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.
10. Make sure no files failed to copy (FAILED column = 0).
11. Remove the old Users Folder from the c: drive: rmdir /S /Q C:\Users
12. Create a NTFS Junction that points to the new Users folder: mklink /J C:\Users D:\Users

The problem with the above method is the drives letters in recovery mode may not be using the correct drive letters when in normal Windows. For example drive C: is the windows drive and drive Z: was the user drive. In recover mode it generally assigns drive letters incrementally so in order to get the drive to mount on Z: the user drive needs to be on the 24th SATA port. This is unrealistic.

Also after performing those steps you would find the user to be locked out because of the user mapping has changed. To fix this boot into safe mode and login and do the following steps outlined in Nigel’s blog

What now? Well I found additional registry entries with REGEDIT under

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

There was 1 line for each profile. Crucially if a profile is bad there are 3 things worth checking
a) Ensure the key name doesn’t end in “.bad”
b) Ensure the RefCount value is 0
c) Ensure the State value is 0

Having gone through all those steps it made the OS unstable. I’m not sure if it’s a hardware issue but there seemed to be long seek times or Windows was taking a lot longer to follow the symbolic link. Whilst it worked, it hangs and long load times was not acceptable to me.

Separate Sub Directories Within Users

This is the easiest setup and I started with using this as my solution when the above method did not work for me. The problem with this was that it left the user directory e.g C:\Users\Danny on the same drive as the Windows partition and I do use that directory (as well as my Desktop which can be mapped to another drive) as my dumping ground. Not totally satisfied I found a workable solution described below.

Change the %UserProfile%

This is the final approach I took. It worked in the end but there was a lot of confusion when I did it but I ended up with the result I wanted.

Before changing the variable the files must be copied to the new drive. To do this I used the above method of dropping into command line, copying the files to the new location. Follow steps the steps in Mounting A Drive To A Directory section. Before closing the registry edit the attribute ProfileImagePath in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList to the path of the new user directory. Reboot and it should be done.

Update 16-Nov-2010
I have just reinstalled Windows and used the Change Profile and there are few things to note:

  1. Make a backup of your data.
  2. Make sure you install the SATA drivers PRIOR to doing any copying
  3. Copy user data to a new directory and delete the old one. Either copy the files onto the same HDD or to an external drive. This is a safer option than to simply rename the folder.
  4. Use Robocopy to copy the newly created windows user directory. DO NOT use the old user directory as the permissions are wrong and the user data such as libraries and configuration files do not match any more.
  5. Copy user files from step 3 in to the robocopied directory. E.g all your music, documents, etc. Do not copy all files blindly.

Summary

Whilst the last method worked. I’d like to go through it again to ensure the steps are correct but I’m sure it more or less sums it up. I’m happy I got the result I wanted but wished the symbolic link worked. I’m looking at separating the install directories as well such as the typical C:\Program Files directory so that the Windows partition only contains Windows related files.


Mount second drive as c:/Users in Windows 7.

Fixing User Profiles in Vista

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Windows and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.