66

I just installed Windows 7 RC1 and want to move c:\users to d:\users.

What's the best way to do this?


Due to the fact that Windows 7 creates a reserved partition that is mounted as C: in the recovery console, I had to use the following commands

robocopy /mir /xj D:\Users E:\Users
mklink D:\Users D:\Users /j

Both D's in the mklink command are correct. When the system reboots, the drive that was D in the recovery console becomes the C drive.

Scott
  • 1,062
  • 1
  • 11
  • 11
  • 1
    Good catch! I'll have to remember that reserved partition detail when I move to Windows 7 – Jimmie R. Houts May 20 '09 at 21:05
  • 1
    Please see this related question (for Vista), and answers: http://serverfault.com/questions/4624/how-do-i-change-the-default-location-for-a-users-home-directory-in-vista/5637#5637 – Benjol Jul 22 '09 at 05:29
  • I can't leave comments, so I'm writing this in an answer. Someone should warn that the /mir option (that it seems stands for "mirror") in the example: robocopy /mir /xj D:\Users E:\Users will delete everything in the E:\Users that is not in the D:\Users. Indeed I'm wondering if the /mir option it's really necessary. I ended up deleting many of my files in my non-empty /Users folder from an older installation. –  Mar 06 '11 at 03:45
  • Isn't is hilarious that the question is closed as off-topic yet has an enormous following with anwsers and upvotes. – captcha Nov 16 '14 at 03:22
  • It's because plebs use this site to ask real questions like this for very real problems, but our high and mighty overlords feel it is useless because they learned this stuff years ago, instead of being thrown into the mass chaos that is IT these days like us. – David Dec 12 '14 at 17:00

9 Answers9

66

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.

Jimmie R. Houts
  • 1,853
  • 1
  • 15
  • 12
  • 1+ offline-move + junction point most easy solution - but I would add that an unattended setup script could do this during installation as well ^^ – Oskar Duveborn May 14 '09 at 14:53
  • This is a really good hack...and I glad someone posted all of the steps it would take to preform this action. – mrTomahawk May 14 '09 at 15:04
  • @Oskar, I think that an unattended script would be the ideal solution. Do you know of a resource that lists out exactly what you need for the unattended script? I have not run an unattended Vista installation (all of my xp installs are unattended though). – Jimmie R. Houts May 14 '09 at 15:46
  • This looks promising. I'll try it tonight. If it works I'll select it as the answer. – Scott May 14 '09 at 16:36
  • Never heard of this one before. If the solution works, this is great! – Aron Rotteveel May 14 '09 at 17:29
  • Yeah! This is just like my hack on a x64 build server box to bounce back and forth between \Program Files and \Program Files (x86). – squillman May 15 '09 at 03:30
  • This didn't work for me. Keeps creating a temporary profile. I did the commands exactly as they are shown except I linked to E:\. – Mike Caron May 20 '09 at 20:14
  • @Mike, are you using Vista or Win7? I have not had any trouble with this process on Vista. If Win 7 could this be due to the reserved partition that Scott points out in the update to his question? – Jimmie R. Houts May 20 '09 at 21:07
  • I've posted a separate answer with some unattended script resources that won't fit in a comment - someone could perhaps edit that into this answer (as I've not yet reached 2000 reps ^^ – Oskar Duveborn May 21 '09 at 14:22
  • 8
    -1 : Please note that this approach does NOT recreate all the junctions that aren't copied by robocopy (nb robocopy can't copy junctions even without /xj, it creates new folders). This won't stop windows working, but will probably break legacy apps which go looking for folders like 'My Documents' etc... – Benjol Jul 22 '09 at 05:31
  • Why the -1? I never said this process would copy junctions inside the Uses folder. AFAIK there aren't any junctions by default inside of the Users folder. Do you know something I don't? – Jimmie R. Houts Jul 22 '09 at 06:00
  • 1
    Change your folder settings to view system and hidden files. The Users folder is chock full of junctions which point (for example) from My Documents to Documents, etc. It is for backwards compatibility with legacy apps, so you may or may not notice the difference, depending on what you have installed. – Benjol Nov 26 '09 at 06:48
  • Any follow up to Benjol's comments? That sounds like a pretty serious issue. – James McMahon Dec 05 '09 at 01:55
  • Benjol posted a blog post about recreating the symlinks (junctions), http://benjol.blogspot.com/2009/05/moving-users-folder-in-vista.html. Just posting that here because 4 questions between SU and SF that cover this issue and aggregating them all is a pain. – James McMahon Dec 05 '09 at 14:06
  • Step 2 should be replace by robocopy c:\Users d:\Users /mir /xj /copyall – Hapkido Apr 22 '10 at 02:29
  • @Benjol, you are correct, there are a bunch of hidden junctions. However, I have yet to run into any problems not having the junctions there. The only problem I've ever run into with this method was the same one @Hapkido documented in his answer (mine has been updated to address the issue). If someone does run into any issues, I would be interested to know the circumstances. My answer has been updated to include a link to your blog post as an alternative. – Jimmie R. Houts Sep 01 '10 at 02:47
  • 3
    +1 @Jimmie for explaining in detail how to do this. I'm really sick and tired of windows just going head and putting user data and application installation where-ever it feels like without asking me first! WTF did they make so difficult to change?? What if my primary partition is a SSD drive and I have windows installed on that for performance? I sure as heck don't want windows using that partition as a god damn pancreas for everything! – greatwolf Dec 13 '10 at 10:02
  • I tried this method and ended up with a machine that wouldn't log me in: Users Service failed or something like that. I had a restore point set up before I did this, but it failed to restore. So... I guess I'm gonna reinstall the OS or try to fix the corrupted logon service. – jcollum Dec 23 '10 at 15:12
  • @jcollum, sounds like you may have forgotten to create the junction on your C: drive, or accidently pointed it to the wrong location. – Jimmie R. Houts Dec 27 '10 at 15:06
  • @Jimmie: nope, I went through the process twice and both times the junction was there and pointing to the correct location. – jcollum Dec 27 '10 at 21:05
  • @jcollum, could it have been due to the hidden boot partition that Win 7 sometimes creates? For example, if when you are in the recovery console and you do a directory listing on the C: drive, is it acutally your C: drive? If not, did you make sure to create the junction pointing D: to D: as the OP had to do? – Jimmie R. Houts Dec 28 '10 at 15:25
  • **Warning:** the /mir option (that it seems stands for "mirror") in the example: `robocopy /mir /xj D:\Users E:\Users` will delete everything in the `E:\Users` that is not in `D:\Users`. Indeed I'm wondering if the `/mir` option it's really necessary. I ended up deleting many of my files in my non-empty /Users folder from an older installation. –  Mar 06 '11 at 03:45
  • @user73274 - I converted your answer to a comment, and also i agree, `/mir` is not nessesary, `/e` would suffice for most people – Mark Henderson Mar 07 '11 at 00:24
  • I've tried this, except for deleting the old "Users" (I renamed it instead), and I see a problem. Because my Windows is localized, explorer sees translated names for some folders -- for example, "Usuários" instead of "Users" -- even while the English name is used on the command line. The thing is, the translated name is now pointing to the old, renamed, folder, while the junction point appears in English. Anyone seen that issue discussed somewhere? – Daniel C. Sobral Apr 05 '11 at 16:44
  • Robocopy version XP027 which is part of Vista and W7 knows the option /SL which can copy symbolic links as links. – ceving Aug 25 '11 at 14:07
  • Heed the warning about including `/xj` otherwise you will end up with a circular folder for `Application Data` which the only way I was finally able to delete was by renaming each subfolder `Application Data` folder to one character name like `1` - about 3 hours of my life lost :| – Daniel Sokolowski Jan 03 '16 at 01:42
11

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.

Hashim Aziz
  • 105
  • 4
Aron Rotteveel
  • 8,239
  • 17
  • 51
  • 64
  • 5
    Yikes! Would not recommend that processes to my worse enemy :-) but... +1 because it works, regardless of how messy might seem. I wonder what other things such 'hack' might break down the line... –  May 14 '09 at 14:36
  • I saw this article, but I wanted to move the entire users directory, and wanted to avoid mucking about in the registry. – Scott May 14 '09 at 16:35
  • 1
    I would add that the problem with moving all the "Special" directories and not Users is that you can't move AppData as a special folder, and increasing numbers of programs keep their caches, saves and large amounts of data there. – Aquarion Mar 10 '11 at 09:01
  • 2
    @Aquarion : BUT the Local, LocalLow, and Roaming directories *can* be moved using the location tab :) – Milind R Sep 01 '14 at 10:35
  • The advances in technology in four years are truly unbounded. The ability to redirect nearly every separate folder in a directory, and every separate folder in a subdirectory of it, but not to easily redirect either parent directory is definitely a sensible limitation that is clearly in the best interests of the userbase. – Aquarion Sep 01 '14 at 13:46
5

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:

Hapkido
  • 193
  • 3
  • 7
3

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)).

Oskar Duveborn
  • 10,740
  • 3
  • 32
  • 48
  • [This is the easiest way to create user profiles in a different location. All the other, unofficial ways, such as messing around with junctions copying or moving files around, gave me "The User Profile Service failed the logon. User profile cannot be loaded." profile error.](http://superuser.com/questions/6391/moving-users-folder-on-windows-vista-seven-to-another-partition/451944#451944) – XP1 Jul 21 '12 at 22:58
  • Windows 8: How to Relocate User Profiles to another Partition or Disk in Windows 8: http://www.eightforums.com/tutorials/4275-user-profiles-relocate-another-partition-disk.html – XP1 Jul 21 '12 at 22:59
  • Windows 7: How to Create User Accounts on another Partition or Disk During Windows 7 Installation: http://www.sevenforums.com/tutorials/124198-user-profiles-create-move-during-windows-7-installation.html – XP1 Jul 21 '12 at 22:59
2

This is a bit late...

The issues with moving c:\users to another disk can be avoided by moving individual profiles rather than the whole directory.

If you leave a junction in c:\users linking to the new directory all the paths continue to work, as with Jimmie Houts solution, however I don't move administrator, network service, public, etc so all the normal system functions, like windows update, continue to work as normal.

Ian

Ian Murphy
  • 1,329
  • 4
  • 19
  • 29
2

"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/

mrTomahawk
  • 1,119
  • 1
  • 10
  • 17
  • As I said on my reply, you *cannot* move C:\Users to a different drive. As your links repeat, you can move some of the "special folders" within it, but the relocation of C:\Users isn't possible. –  May 14 '09 at 14:33
0

This is not exactly what you need but if are in Windows 7 a really good alternative is to change the location of the Libraries. By this method you save Documents, Pictures, etc but not all the profile in the D drive.

Last night i created a tool that may be useful for you: Set Libraries.

Ricardo Polo Jaramillo
  • 2,039
  • 1
  • 18
  • 35
0

I researched the same thing for a long time. It can't be done. You can move the "special" folders (Documents, My Music, etc), but can't relocate the Users directory.

0

Most of this is copied from others, then modified and expanded by the present writer, tu servidor.

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, just in case: 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: Boot with the Win7 Install DVD, choose language, currency and keyboard, and hit Next. At the screen with the "Install Now" choose "Repair your computer" You will be asked if you want to "Repair and Restart" by the System Recovery options, choose "No". 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. 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 /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.

  • 1
    This seems like a longer version of Jimmie R. Houts' answer, but it doesn't address anything new or the issues with his answer (not copying symlinks over). – James McMahon Dec 05 '09 at 14:01