Sunday, 26 January 2020

filesystems - Mount second drive as c:/Users in Windows 7


So about a month ago I set up a Windows 7 Professional machine where I was able to mount the secondary hard drive to the path C:\Users. This put all of the userspace files on the second hard drive without all that mucking about with registry editing. It has worked wonderfully and now I am trying to replicate it and I cannot seem to remember how I did it. Which makes me feel like quite an idiot.


I believe I somehow moved the content of the c:\Users folder to the second Hard drive. Then I mounted the d: drive as c:\Users. Easy enough but I am unsure how I got the contents of the c:\Users folder moved over and deleted before I mounted the secondary drive (sice it needs to be an empty folder and all). It is up and working on my previous machine but now I need to do it on a new machine and I cannot for the life of me remember how I did it, nor where the instructions are that I used. Other than in the end the entirety of the Users folder was moved to the d: drive and I do not have a C:\Users folder.


Any thoughts on how to do this again, or links to instructions? Individual profile moves are not going to solve this problem. Thanks.



Answer



It looks like Jimmie R. Houts over at serverfault has the answer I am looking for. He referenced this article with more information.


To expand on his answer, after installing Windows 7:



  1. You boot with the install media.

  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 OSs available for recovery and it's selected; then press "Next".

  5. You will be given a list of recovery tools; chose "Command Prompt".

  6. In the command prompt you will be using Robocopy to copy C:\Users to D:\Users.

  7. Type robocopy c:\Users d:\Users /mir /xj

    • /mir tells robocopy to mirror the directories; this will copy all files and permissions and will delete any other files in the target directory (reference). If you already have user profiles in D:\Users and want to keep them, try /e /copyall instead; this copies everything recursively (/e), all file attributes included (/copyall), though for some reason you might have to adjust ownership permissions later anyway.

    • /xj is very important, this tells robocopy not to follow junction points. If you forget this, you will have a lot of trouble.



  8. Make sure no files failed to copy (FAILED column = 0).

  9. Remove the old Users Folder from the C: drive: rmdir /S /Q C:\Users

  10. Create an NTFS Junction that points to the new Users folder: mklink /J C:\Users D:\Users. Make sure the target, D:\Users, uses the drive letter which will be used after restarting, not as it is during the recovery command prompt session (Thanks mindless.panda, and matt wilkie).


Now restart 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 fire and forget.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...