Migrating your Win7 Users directory off your SSD.

Submitted by WhoCares on Sun, 09/22/2013 - 21:43

As I'm sure happens to many these days, you upgrade your main Windows 7 system drive to a new blazing fast SSD, but of course, you run into space issues (unless of course you're loaded and can afford the proper big ones, or have no media files at all) I recently migrated my inlaw's main PC from the old 1TB spinning platter SATA disk to a new 120GB SSD. This was great as the system speed has increased dramatically. And since we were upgrading the hardware we also took the opportunity to roll back the system to factory (and then apply the updates and drivers). I however didn't mention the fact that the old disk was now setup as a data drive, partitioned as "D:". Shortly thereafter he called to say he was having trouble moving his files back from his external storage. I knew immediately that the drive had run out of space (I think the "My Documents" library system needs some work)

Some quick googling turned up the following guide:
http://lifehacker.com/5467758/move-the-users-directory-in-windows-7

I've read all I could find about this, and the information below is correct and tested:

To most easily move all user files and user program files off your boot drive (an SSD in my case), follow these instructions.

FIRST, Create a restore point (they're better in Windows 7 than you might remember):
1. Open System by clicking the Start button, right-clicking Computer, and then clicking Properties.
2. In the left pane, click System protection. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
3. Click the System Protection tab, and then click Create.
4. In the System Protection dialog box, type a description, and then click Create.

THEN: Go to System Recovery/Command Prompt:
1. Boot with the Win7 Install DVD, choose language, currency and keyboard, and hit Next.
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, and that it's selected and then press next. You will be given a list of recovery tools.
5. Choose "Command Prompt".

Find your virtual Windows drive loaded from the Win7 media (probably either C or X), find your actual Windows/SSD drive (D or E) and find your HDD (regular hard drive) (D or E).

In my system normally, C=SSD with Windows on it, D=HDD data drive

Using Win7 Update media, the drives in Recovery mode were set up differently, thusly:
X: virtual/temp Windows drive,
E: actual Windows/SSD drive,
D: HDD, hard drive I wanted to put \Users on.

Some report that System Recovery mode will set up their drives like this:
C: virtual/temp Windows drive
D: Actual Windows/SSD drive
E: HDD, they want to put \Users on.

In the command prompt you will be using Robocopy (NOT xcopy!) to copy c:\Users to d:\Users, then delete the old c:\Users, then make a symlink from c:\Users to D:\Users. Note that you must do these things in order, and you must not have a d:\Users dir before you do this.

NOTE: in the System Recovery command prompt window, your drives are not the same as they will be after you leave recovery mode! So adjust the commands below for how the drives are in Recovery Mode, and then they'll turn out correct later.

I used:
robocopy /copyall /mir /xj E:\Users D:\Users

To move \Users from Windows/SSD to HDD.
/mir tells robocopy to mirror the directories, this will copy all files and permissions.
/xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.
Make sure no files failed to copy (FAILED column = 0).

Then you must remove the old Users Folder from the Windows/SSD (c:) drive, before you can create the symlink:
I used:
rmdir /S /Q E:\Users

Create a NTFS Junction/symlink that points to the new Users folder:

I used:
mklink /J E:\Users D:\Users

Use the /J switch to create a junction that's a hard symlink. (If you use the /D switch, you'll also have to edit the registry, cuz it won't be a hard link.) Using /J, when Windows looks for the C:\Users dir, it will find it! But it will be on the HDD instead of the SSD. Tricky!

To see the proof of what you've created, still in the command prompt window, go into the actual Windows/SSD and do the "dir" command, and you'll see:
" Users [D:\Users]"

Now restart and you'll see \Users on your HDD, and there you go. No further configuration or fiddling required. New user profiles will all be stored on the D: drive, as will any user specific data. And it is achievable without any messing about in the registry, searching and replacing values, or having to mess with new profiles in any way. Totally set and forget.

If you give the method above a try, make sure you set your System Restore point just in case something goes wrong. If you've tried this or other methods, let's hear about it in the comments. Thanks Roobs!

Update: Reader James writes in to note an error in an important step in this guide; we've fixed the error, but in case you were afflicted, James said he was able to recover using the following steps:

*DON'T* use system restore yet, it doesn't know what you've done with your user profiles and therefore can't repair the permissions on them.
Isolate the copy of your user profiles from the NTFS junction: move D:\Users D:\Users2
Delete the NTFS junction: rmdir D:\Users
Copy your user profiles back over to your boot drive: robocopy /mir /xj D:\Users2 E:\Users
Now use system restore, either to the point you created in the instructions or an earlier point. This will repair the permissions on your user profiles.
Reboot and you should be able to login...

Thanks James!

For me the process was similar except The SSD was in fact F:, the data drive was C:

Initially I must have gotten the symlink wrong as "mklink /J F:\Users C:\Users", and when the system rebooted it would not login. The solution was as pointed out in the following comments:

The above worked flawlessly for me with the exception of one thing! When I logged into Recovery Mode, my C drive was renamed D, and my D drive was renamed E. I therefore used the command:

"mklink /J D:\Users E:\Users" to make my symlink.

Unfortunately when I rebooted, Windows 7 couldn't find my Users directory (it was looking for the non-existant drive E:) so I couldn't log in! Apparently whilst the first drive letter in the mklink command refers to the current name of the drive you want your link to be, the 2nd drive letter refers to the name on reboot of the drive you want your symlink to point to. Since I wanted it to point to my D: drive, I re-did the command as:

"mklink /J D:\Users D:\Users"

The above is not a typo btw! It basically says "put a symlink in the current D: drive to point to whatever drive is D: on reboot".

Strangely I still couldn't log-in due to the Users directory being missing on the previous boot attempt. I had to safe-boot and use regedit to make a quick registry adjustment (I googled the error windows gave me on log-on which led to a quick solution).

After that all was well!

p.s. someone said it was a good idea to hide the users file on D: (presuming you moved it to D:). This will avoid e.g. Windows Media Center indexing your files twice.

Thanks for a great guide. Hope my comment helps someone out there.

I modified this procedure a bit, and instead of deleting the original C:\Users folder from the recovery console, I tried renaming it from the command line just before I built the symlink. That may have been my undoing.

When I got into the system via Safe Mode, I found my symbolic link to D:\Users AND the C:\Users folder (still with its original name!), and that may be why I got the "could not load profile" error; when I tried to go into the symlink I got a "could not access" error.

Here's what I did: changed the C:\Users folder to C:\Users.old, then I deleted the symlink to D:\Users. Once that was gone, I went into the command line and rebuilt the symlink. I tried the new symlink and found it opened my D:\Users folder nicely. But my profiles still wouldn't load.

I then found I had to return to Safe Mode and go into the Registry. The unsuccessful logons established new entries in the "ProfileList" registry key(HKLM|Software|Microsoft|Windows NT|CurrentVersion|ProfileList). What I found was that aside from the system profiles, I had two long subkeys, each of which had a duplicate with ".bak" extensions.

I deleted the keys WITHOUT the ".bak" extension, then renamed the remaining ones to remove the ".bak".

This worked. But if you aren't comfortable playing in Registryland, hand it off to someone who is.

System is now running superbly again, and he now has nearly a Terabyte for all his media, and his system drive has a nice 50gb breather for programs!

Blog

Migrating your Win7 Users directory off your SSD.