2012.12.09 – I have created a new post that explains a much better way to not move the Users folder after it is created but instead tell the Windows installer where you want to create the Users folder. This is a much better way of having the Users folder placed in a new location – Click here to see the new method
If you are like me and you like to keep personal data separate from the OS partition then this tip is for you.
I have been trying to find a good way to move the “C:\Users” folder to the D drive or to any drive for that matter and keep my programs happy. I found out from research that there were a lot of ways to do this, most of these solutions were half way band-aid solutions. I don’t do band-aid solutions, I am a power user and I want to know how to move it properly no matter how complex!
Before you tell me that “Hey wait you can just right click on a special folder and go to the location tab and….” Again this is one of those half solutions…. I want to move the entire Users directory. One thing I found out the hard way was that you will need to do this on a brand new Windows 7 install, you can have real issues taking existing accounts and moving them to a new location, not unless you want to open the users registry and replace every instance of C:\Users with the new location and search all config files of installed applications, more or less it is not a good idea!
So I have have now successfully used this method on over 8 different machines at work and my home machine with zero issues:
- Install Windows 7, this will normally force you to create a default user.
- You will normally be logged in as the user that the setup creates.
- Enable the Administrator account and give it a password.
- Give your volumes a name C: = OS, D: = Data just right click the drives and rename them in “My Computer” (This will help later to determine what drives are what in recovery console).
- Boot the system with your Windows 7 DVD and chose to repair your computer.
- Chose your OS from the list (should only be 1) and Click Next.
- Windows will try to repair your install but just chose no to any suggestions (this process may take a bit to find problems be patient).
- Chose advance options to repair my computer.
- Chose “Command Prompt” when the next window shows up.
- Because Recovery console works in DOS it might see your volume letters in a different order then Windows sees them. So we have to figure out if they are in the right order as Windows sees them. We will use diskpart to do this.
- Open the DISKPART tool by typing “diskpart<enter>”.
- Run the command “list disk<enter>” This will give a list of all the disks attached to your system. You should be able to tell which disk is the one with your C and D drive on it, most sytems only have one drive so you will only see one drive listed. If you have more then one drive you should know based on its size.
- Once you know what drive is the one with your OS and Data drive then we will need to select that disk for use.
- I select the disk by running the following command “select disk #<enter>” where # is the disk number on your system.
- We can then list the volumes on the disk we have selected by running “list volume<enter>”.
- You will now see a break down of your volumes on the disk and you will see the drive letter (Ltr) assignments beside the volume Label. If for some reason you do not see your OS or Data drive label listed here then you may have selected the wrong disk, go back to step 12 and select a different disk.
- You will now need to confirm that your OS volume is Ltr C and your Data volume is Ltr D. If they match up already then you can exit DISKPART by typing “exit<enter>”, you can then skip to step 26. If your drive letters do not match their labels then we will have to reassign their drive letters in the following steps.
- Each case will be different depending if you have a recovery volume from Dell or hidden volumes etc. The main point is that you will need to finish with C = OS, D = Data everything else is not a big deal.
- Here is the hard part, if the C and D drive letter is already used we will have to do some shuffling around as we cannot assign a drive letter that is already in use. The easiest part is to look at what volume has the C Ltr assigned to it and reassign it to some higher value.
- Select the volume that is using the C Ltr buy doing “select volume #<enter>” where # is the volume on you machine that is using the C letter.
- We will change its volume letter from C to Y or something else high by using the following command “assign letter=y<enter>”.
- You can do a “list volume<enter>” again to see that the drive letter has been changed for that volume. repeat steps 20-21 for the volume that is using the D letter but use a different higher letter to change it to.
- Now that the C and D letter are not being used we can assign them to teh Data and OS volume. Run the command “list volumes<enter>” and figure out what volume has the label of OS. Run the same steps as above for selecting that volume and then assign it a drive letter of C. Repeat this for the Data volume.
- Once done run the “list volumes<enter>” to make sure all your drive letters are in proper alignment with their volume. If you are anal you can make sure the rest of your drives are in proper order after that.
- You can exit DISKPART by typing “exit<enter>”.
- Now that your drive letters are in proper order we need to copy over our Users folder to the D drive and create a junction to it.
- Run “robocopy /copyall /mir /xj C:\Users D:\Users” This command will copy all data from the “C:\Users” directory to the “D:\Users” folder but will skip junction points or else you will be caught in a endless loop and will fill your drive with bottomless folders (I’ve done it before). There will be some files at the end that show skipped, this is expected and are only junction points that were skipped.
- Run “rmdir /S /Q C:\Users” This command will remove the User directory from the C: drive and all folders recursively underneath it along with all junctions.
- Run “mklink /J C:\Users D:\Users” This will create a junction point on the OS volume called Users that will point to D:\Users. Why would you want to create a junction point? Normally most applications should be looking up the location of the user profile folder from the registry and then read its path from there but if for some reason some applications have it hard coded to look for the User path in C:\Users. So if this happens the Junction will redirect the file request to the D: volume and the application will be none the wiser as it thinks its access it on the C:\Users.
- Once this is done we need to confirm the junction was created properly. To do this we need to do a dir on the C: volume and it should show the Users directory is now a junction and where it is pointing to. If you need to make corrections at this point to the junction mapping if it’s pointing to the wrong location. To triple check you can even try to do a “cd Users<enter>” then a “dir<enter>” and you should see your user folders, if you don’t check your mappings again!
- You can close the DOS prompt and chose reboot.
- Login as the Administrator
- You may get some errors that it cannot find some folders. This is expected because we have not changed the registry yet to point to the new location. Ignore any of theses errors.
- Run Regedt32 and navigate to this key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList”
- In the the above key (looks like a folder) on the right hand side should be 5 registry values. In only the 3 strings below replace %SystemDrive% with D:\ (or whatever drive now holds the Users folder)
- Change These values (double click them to edit them)
%SystemDrive%\Users\Default change to D:\Users\Default
%SystemDrive%\Users change to D:\Users
%SystemDrive%\Users\Public change to D:\Users\Public
Do Not Change These Values
ProgramData – Leave this set to its default value
(Default) – Leave this set to its default value
- in Regedt32 under the ProfileList Key you will see sub folders if you click on each one of theses you will see ones that have the Administrator name and one that has the user you created during the install. You Need to delete both of these keys. By deleting these keys Windows has not record of that users creating and will recreate their user information in the registry with the new values on next log on.
- In the new User directory doe me it’s D:\Users you will need to delete the folder of the user that was created during the install. Again we do this because Windows will recreate their profile with the newly updated information as to where the User Profile directory is. Please note you will not be able to delete the Administrator account folder because you are currently logged in as that account and most files are locked.
- You will need to reboot the machine (important to unlock all files).
- Log in as the user you created during the install.
- A new profile should be created.
- You can now Disable your Administrator account unless you want to leave it active (you better have a password on it!!!).
- Delete the Administrator’s User folder in the Users directory. Again reason is if the Administrator ever needs to log back in a new profile will be created.
From this point forward all new users will be created in the D:\Users, anything needing to still access the C:\Users directory will also be happy!
2011.08.08 – Thank you to Gonza that pointed out the use of DISKPART to ensure the drive letters are in the proper order before doing a junction or else Windows gets mad. I was always lucky and C=C and D=D in the recovery console so I never had to deal with the issue of drives out of order.
© Caspan 2011