What's the best way to move c:\users to d:\users under vista/W7

Solution 1:

You can move the entire C:\Users folder to a different drive pretty easily after windows is installed:

Warning: Doing this may cause issues if/when you need to perform a System Restore

  1. Boot to the installation media, and get to the command prompt (press Shift + F10 on the install dialog)
  2. Use Robocopy to copy C:\Users to D:\Users: robocopy c:\Users d:\Users /mir /xj /copyall
    a. /mir tells robocopy to mirror the directories, this will copy all files
    b. /xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.
    c. /copyall will copy all the attributes includings ACL and Owner info
  3. Verify that the files successfully copied
  4. Delete c:\Users
  5. Create junction that points to d:\Users: mklink c:\Users d:\Users /j

That's it. I've been using this process since Vista went RTM with no problems.

Here is an article that explains it as well. Just use robocopy instead of xcopy as he does in the article to avoid possible ntfs permissions problems.

Update: Because I found out the hard way, I thought I'd also mention that if you are planning on moving "Program Data", or "Program Files" with this method, you will be disapointed to find out that everything works as expected, but windows updates will no longer install. I'm not sure if this has been fixed Win 7.

Update 2: @Benjol has a blog post that details a method of moving the profiles folder that will recreate the junctions that this method leaves out. If you run into any issues with legacy apps, take a look here and see if his method resolves the issue.

Solution 2:

The easiest and recommended way is to move the individual special folders inside a user directory, such as Documents, Music, Videos, etc. You can do this with the following steps:

  1. Right click > Properties
  2. Location tab
  3. Fill in the desired location and click 'move'

The downside to this is that it still leaves the main 'Users' folder in place.

The hard way is a lot more complicated and risky:

In my search for a solution, the only two easy ways I found to move the user profile directory locations from the system drive is to

  1. Set the User Profile folder during setup using an unattended install file.
  2. Move the individual folders inside your user profile, which can be done using explorer (which will update the registry keys HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders and HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders).

However, this was not good enough for me, I wanted my actual user profile folder to be moved to a seperate partition/volume, including registry settings. I discovered that it is not actually that hard, provided you’re comfortable with mass replacing registry keys and values.

Here is how I moved my user profile location. Please note that I wanted all of the profiles moved, included Public and Default, so some of these steps can be skipped if you do not want that:

  1. Make sure you have a complete backup of your system!
  2. Copy the original Default Profile directory to the new location (e.g. from C:\Users\Default to D:\Users\Default).
  3. Copy the original Public Profile directory to the new location (e.g. from C:\Users\Public to D:\Users\Public).
  4. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList.
  5. Change the value of the Default key to the new user profile location (e.g. D:\Users\Default).
  6. Change the value of the Public key to the new user profile location (e.g. D:\Users\Public).
  7. Change the value of the ProfilesDirectory to the new user profile location (e.g. D:\Users).
  8. At this point, you need to restart and log back in as a different user that has never logged in before and therefore does not have a profile created. In my case, the Administrator user had never logged in before so I enabled it so that Administrator could log in and used that. You can enable Administrator login by loading Computer Management and then go to User Accounts, edit the properties for Administrator, and then uncheck Disable Login.
  9. After logging in for the first time with the new user account, you will see “Creating Desktop” and other things like that while Windows is creating your profile. Note that the new profile should be created in the new location.
  10. After logging in, try to close as many applications as possible. This will prevent most files from being locked so that you cannot copy them.
  11. Copy the entire original user profiles folder from the original location to the new location (e.g. C:\Users* to D:\Users). (See next step after copy starts).
  12. There are a few things to note during this copy. There were thousands of .TMP files that were locked and would not copy. I just skipped these files. I held down Alt-S so that I could see all of the skipped files and make sure that there were only .TMP files being skipped. Yes, this took a little while, but at least I was confident that I got all of my files copied. This process could probably be made easier using the command prompt or powershell.
  13. If, in your case, there are some files that will not copy, you can run procexp.exe, which is file provided by sysinternals. Then do a Find Handle and search for part of the filename. procexp will tell you which programs are locking the file. As long as you closed as many programs as you could, though, this should not happen.
  14. Find and download a program that will do a Search & Replace on the registry. I will not suggest one because I did not find one single program that worked perfectly. I ended up downloading a few different freeware applications and using all of them.
  15. Using the Registry Search & Replace program, do a search for the original user profile folder and replace it with the new user profile folder (e.g. search for “C:\Users” and replace with “D:\Users”. Note that some of the applications I used would only change values and not key names. However, the keys that needed to be chagned were all related to MuiCache. I do not know if these actually need to be updated. I did just to make sure.
  16. Log out. Log back in with the same user. Repeat step 14 until there is nothing left to replace. The reason for this step is that on logout, some programs seem to update the registry using the old user profile path.
  17. Run regedit.exe and do a search for the original user profile path and make sure it does not exist. The reason for this step is because (as noted in step 13), I did not trust any of the Registry Search & Replace programs I used. I ended up needing to update about a dozen of the keys and values manually, since the search & replace missed them.
  18. So that you can easily find programs that do not use the registry and hard-coded profile paths, rename your original profile folder (e.g. rename C:\Users to C:\~Users).
  19. Log out. Log back in as your usual user. Everything should be working correctly except for programs that use a “hardcoded” user profile location.
  20. There are two easy methods that can be used to find programs that use a “hardcoded” profile location and are still looking for the original user profile path. You can use the procexp.exe trick mentioned above and search for handles in the original profile location. You can also monitor the oringal profile location to see if any new folders or files were created. For example, in my case, FolderShare created some folders and files in the directory C:\Users\MyUsername\AppData\Local\FolderShare. So, I updated the FolderShare settings to point to the different path and then deleted the C:\Users directory (note that C:\~Users still existed as a backup).
  21. Since you are now confident that all of your data has been moved (right??????), you can deleted the backup of the original user profile location (e.g. C:\~Users).

Source: Change User Profile Folder Location in Vista

Seeing the fact Microsoft made it so easy to change the location of the special folders, and so hard to change the location of the entire user folders structure, I would strongly advise you to take the easy approach.


Solution 3:

Here's the correct process

  1. Boot to the installation media, and get to the command prompt (I believe you need to click repair first)
  2. Use Robocopy to copy C:\Users to D:\Users: robocopy c:\Users d:\Users /mir /xj /copyall
    a. /mir tells robocopy to mirror the directories, this will copy all files
    b. /xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.
    c. /copyall will copy all the attributes includings ACL and Owner info
  3. Verify that the files successfully copied
  4. Delete c:\Users
  5. Create junction that points to d:\Users: mklink c:\Users d:\Users /j

I did the Jimmie instruction's and I was almost working. However, I had a strange issue with IE, I was unable to download a file. I found the solution to fix my download issue and it is documented on superuser:


Solution 4:

Some resources for "automatically" moving C:\Users with an unattended script during installation.

Microsofts has a KB with some issues surrounding moving special folders which could be useful to read through.

When it comes to the unattend script itself, there's an element called FolderLocations which has a ProfilesDirectory child you can specify as such:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS"
processorArchitecture="x86">
<FolderLocations>
<ProfilesDirectory>d:\users</ProfilesDirectory>
</FolderLocations>
</component>
</settings>
</unattend>

Here's the Microsoft articles about deploying Vista which includes how to handle unattend.xml and here's the best source I've found of the extended How to move special folders article by Ramesh Srinivasan which explain in depth how to do this and what to watch out for (including the fact that even after this unattend script has run, eg as an argument to setup.exe, there are still junction points like c:\documents and settings that points to the old location that you'd need to fix manually (if possible)).


Solution 5:

"C:\users" is a system folder which is equivalent to "C:\Documents and Settings" on Windows XP/2000/NT, and because of this it was really hard if not impossible to move the folder. There were several ways to work around this issue by moving the subfolders via the TweakUI or some similar hacks instead of the parent folder and there are many posts about this see here:

http://www.tech-recipes.com/rx/1409/move-your-documents-and-settings-username-profile-off-of-the-c-drive/

http://support.microsoft.com/kb/236621

http://support.microsoft.com/default.aspx?scid=kb;en-us;314843

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q310147&ID=KB;EN-US;q310147

But in regards to Vista/Windows 7, it appears as though this process may have gotten simpler. Here are some posts which tell you how to do it on Vista, which at its heart what Windows 7 is:

http://www.ehow.com/how_2064387_relocate-user-files-windows-vista.html

http://www.technospot.net/blogs/how-to-move-users-folder-to-different-location-in-windows-vista/

http://www.howtogeek.com/howto/windows-vista/moving-your-personal-data-folders-in-windows-vista-the-easy-way/