Redirecting a user profile to a different drive

2

Setup

On my PC, I have a 120GB SSD (C:) for the operating system and a 2TB HDD (D:) for data. So, I've redirected my user folder from the usual C:\Users\%userName% to D:\Users\%userName% with the mklink /j command to create a directory junction link (see screenshots).

I've set up my PC this way for the following reasons:

  1. My SSD is simply too small to contain my user folder, so it has to be relocated
  2. If anything ever goes wrong with Windows, I can just wipe the OS disk and retain my user data
  3. If anything ever goes wrong with the HDD, I can still log in as administrator, as the account lives on C: (this is probably a moot point, however, as Windows would probably log me on with full permissions but a temporary profile generated on C:)

 

Issues

Since I've done this, however, I've noticed some weird symptoms - every now and again, when I log on:

  1. All of my file associations will have been reset to default
  2. My Explorer window size will have been reset to default
  3. My startup settings will have been reset to default
  4. My system tray preferences will have been reset to default (see screenshots)

Normally, I'd conclude that this is because Windows can't load my profile and, therefore, my preferences and has, as a result, logged me on as a temporary user but:

  1. I'm not logged on as a temporary user
  2. All other user preferences are unaffected, notably:
    1. Task/superbar pinned items and position
    2. Context menus are correct
  3. All of my data is available
  4. Restarting the PC (maybe unnecessary) and logging back in will eventually correctly load my profile

Every few months, though, when I cold log in (that is, not resuming an already logged-in session) I will have been logged in as a temporary user and my user profile will be corrupted beyond recovery, so I have to entirely rebuild my user profile

 

Diagnosis

Unfortunately, I haven't been able to identify a pattern yet but I've been able to deduce a few things:

  1. It is not SSD-related. I've replicated the setup on my work PC (which has 2 HDDs)
  2. It is not because the entire user folder is redirected. I have since experienced with redirecting only subfolders of C:\Users\%userName%\ so as to leave the NTUSER.* system files in the "correct" location

As far as I can see, there aren't any obvious errors in Event Viewer.

 

Misc Info

As far as I can remember, Microsoft's official way of redirecting a user profile to another drive can only be done during the install, which is of no use to me. And it just redirects the entire \Users folder anyway?

Not being able to restart your PC for fear of corrupting my carefully-crafted user profile is really an inconvenience. :(

 

Screenshots

User profile redirection method #1:
enter image description here

User profile redirection method #2:
enter image description here

System tray when issue occurs (the programs are running - they're just hidden):
enter image description here

System tray after restart:
enter image description here

mythofechelon

Posted 2013-02-15T18:53:37.757

Reputation: 653

Answers

0

The only way I could successfully redirect my user profile without issue was via the official, very crude method of changing the location for special folders (Documents, Downloads, Music, etc) in the registry.

Normally, you do this by right-clicking on the special folder, clicking Properties, and changing the Location value.

I chose to do the more manual way of doing it, however, because that way I can redirect ALL folders, not just the ones that they let you do.

The only difference, really, is that manually doing it doesn't move your user data but that's irrelevant in this situation as it already exists at the target.

So, I:

  1. Modified the following registry values to update the default paths (C:\Users\Ben, for example) to the actual ones (D:\Users\Ben, for example) via RegEdit:
    • Key: HKCR\Environment\
      • Name: TMP
      • Name: TEMP
    • Key: HKCR\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\
      • Every single value with Data beginning with C:\Users\
    • Key: HKCR\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\
      • Every single value with Data beginning with %USERPROFILE%
  2. Enabled the local administrator account
  3. Logged out of my account and in as the local administrator
  4. Appended a .OLD file extension to the C:\Users\Ben symlink to stop Windows from using my redirected profile
  5. Logged out of the local administrator and back into my account

So, all that's left in C:\Users\Ben\ is the NTUSER.DAT file (my HKEY_CURRENT_USER registry hive) and data used by programs that use hardcoded paths.

I've implemented this fix at home and at work around a month ago and it has been surprisingly seamless with no issues as of yet.

mythofechelon

Posted 2013-02-15T18:53:37.757

Reputation: 653

0

Try a symbolic link. It allows you to store your data on your D: drive while making it appear like it's on the C: drive.

Instructions from ServerFault.

Instructions from HowToGeek.

Kruug

Posted 2013-02-15T18:53:37.757

Reputation: 5 078

I did. That is my current setup. I used the mklink /j command. – mythofechelon – 2013-02-15T19:06:37.490

@BenHooper Then, not knowing much about symlinks in Windows, I would assume it's a timing issue. Explorer loads before the symlink is re-established. – Kruug – 2013-02-15T19:43:09.427

@BenHooper Does it still happen if you use mklink /D? – Scott Chamberlain – 2013-02-15T20:05:11.977

@ScottChamberlain Am I right in thinking that if I just replace the directory junction with a directory symbolic link (from another account) that it should just carry on working? – mythofechelon – 2013-02-16T17:43:10.490

@ScottChamberlain Yeah, that didn't work either. – mythofechelon – 2013-04-15T11:45:19.857

0

It will be a little tricky, but you can try to create a separate partition for user profile on your 2nd drive and mount that partition in C:\Users\%username% directory.

To mount a partition in a directory:

  1. Empty that directory (you'll have to log in to another user account or use LiveCD instance of Windows).
  2. Right-click Computer (desktop icon, Start menu item or in the explorer's left pane) and choose Manage
  3. In the left pane select Disk Management.
  4. Right-click your new partition, choose Change drive letter and paths...
  5. Mount it in desired directory.

gronostaj

Posted 2013-02-15T18:53:37.757

Reputation: 33 047

This looks promising. I'll give that a go later. Will this be as seamless (in that programs generally don't know that they're working off a seperate drive) as junction / sym links? – mythofechelon – 2013-04-15T11:47:08.597

Actually this technique is based on the same NTFS feature that junctions use. Be careful though, some directories cannot be mounted like that. Users should work. – gronostaj – 2013-04-15T11:51:16.850

So is there really any point in doing this if I'm just using a GUI instead of command line? – mythofechelon – 2013-05-03T10:19:32.413

Regular junction would mount a directory in Users. This way you'll have entire partition (i.e. drive's root) mounted in a directory. It will also be possible to access that drive by its letter if you want. – gronostaj – 2013-05-03T13:39:43.723