8-Bit Geek

Moving Windows 7 User Profiles off the C: Drive

Overview

Sometimes you just have to reinstall Windows. This can be for a myriad of reasons: hard drive goes bonkers, virus, you screwed up, Windows screwed up, etc... Whatever the reason, one of the most painful parts of the re-installation of Windows is making sure you get all the user data. Most user data is stored in the user profile in "C:\Users\username" so this chore becomes easier. However, you don't want to just merely copy the user profile from the old installation and drop it into the new installation. That generally will cause all kinds of wierd anomalies. If you're not using roaming profiles (and most home and small business users are not) then you want a more robust method of keeping your user profile intact when you reinstall Windows.

What we do below is move all user profiles to the D: drive. This gives us an extra layer of comfort in case something goes wrong. Please understand this is not a backup solution at all. There is still only one copy of your data. If you want a backup of your data, you will still need to use some sort of backup solution that fits your needs. What this does do for you is it gives you a fast and easy way to reinstall Windows without having to mess with moving your data around which is a royal pain. The reason this is a good thing to do even if you do have a backup solution is that often times, the backup solution will not be able to do a full restore of Windows from scratch. This helps with that. Sometimes, you don't want to restore the Windows operating system from backups and just want to do a reinstall anyway. This helps. You can always image your system to make reinstallation faster. But if you don't move those user profiles off the C: drive, you have a lot of extra manual work ahead of you. By moving the user profiles before we image the system, a 10 minute re-imaging procedure is all that is needed to reinstall Windows with all of your user data and settings intact and ready to go.

A comfortable level of familiarity with Windows and Knoppix are assumed in this article. Tools are suggested with no instruction on how to use them. If you need help with these tools, you will have to find that help elsewhere. As always, read the entire article and make sure you understand it thoroughly before starting the process.

Instructions

First, setup three partitions. C: as NTFS, D: as NTFS, and a third partition as ext3. The size of the C: and D: partitions is up to you of course. But for most people I recommend about 100-200GB for the C: partition. For gamers or others who may be installing large numbers of large applications, a dedicated hard drive of 512GB or larger is recommended. The recommended D: drive size will vary wildly based on your use case. People who use applications that save very little data wont need a large D: drive. However, if you're playing games that generate large savegame files, running virtual machines that use large virtual disks, or run programs like video editors or game development suites, then your D: drive should be a dedicated drive or RAID of at least 2TB. Your ext3 partition should be at least 1/3 - 1/2 the size of your C: drive. And since this partition will almost never be used, it's a good case for a cheap large spinning disk if you don't want to give up any storage on another disk in the system.

Install Windows 7 Beta by hand. During the install when asked to create a username, create a temporary username that will be removed later. I use 'tempadmin'.

As soon as Windows is done installing, BEFORE DOING ANYTHING ELSE, login as tempadmin and disable System Restore. If you want to use System Restore, you will can enable it again later, but you do not want it enabled while moving the profiles around.

You'll need to copy C:\Users and C:\ProgramData to D:\. I highly recommend against doing this manually. You'll also need to edit the registry. Fortuantely, I'm a very nice guy and I've already scripted the entire process for you. It will create an exact replica of the required directory structures on the C: drive (minus any files in use which should be limited to .log files that we don't care about.) It will also apply the registry settings from a Profile.reg file I've exported. I wont go into details here about what the script does but it is a very simple batch script (albeit an ugly one) so if you really want to know what it does, just read it.

Windows 7 Profile Move.zip

The script (profile.bat) and the Profile.reg file are included in the zip file. Download it to a USB thumb drive or some other suitable form of media and transfer it to the system you want to configure. I recommend dropping these into D:\temp or C:\temp for ease of access.

Once you have the files on your system, you will need to set a password for the Administrator account and then enable it. In the Start Menu, find the "Command Prompt" and right-click on it. Choose "Run as Administrator". Once this is open, type these commands substituting 'password' with the actual password you wish to use:

	net user administrator /active:yes
	net user administrator password

It will be required to login as the Administrator to perform the directory copies unless you care to setup your tempadmin account with the appropriate permissions. I have not tried to do that and I do not care to try since using the Administrator account is easy. If you do not want your Administrator account enabled, just remember to disable it when you're done here. I'll make a comment below when that's appropriate. But now that you have your Administrator account enabled, logout of the tempadmin account and login with the Administrator account.

While logged in as the Administrator, open a command prompt, cd to the directory where you have stored the profile.bat and Profile.reg files (they need to be in the same directory.) Now, just type: "profile.bat". The script will copy as much of the required directory structure as it can from the C: drive. It will also create the junctions and symlinks and set permissions where needed. After that, it applies the registry changes and finishes.

Reboot your computer.

Login as Administrator again. Create a new user in the Computer Management control panel and add this user to the "Admins" group. This is to be your normal user account or normal admin account.

Reboot the computer.

Login as the new user you created (or Administrator if you did not add your new user account to the "Admins" group.) At login, the new user's profile will automatically be created in "D:\Users\username".

In Computer Management, remove the temporary account that was created while installing Windows. If you did not add your new account to the "Admins" group, then you will need to logout of the Administrator account now and login as your new user account. If you did add your new account to the "Admins" group, then you should already be logged into it and now is the time to disable the Administrator account if you so desire:

	net user administrator /active:no

Epilogue

At this point, your profiles are successfully moved to the D: drive. If that's all you wanted to do, stop reading here and be happy. I highly recommend some other steps, though . . .

If you really want to use System Restore, now's the time to reactivate it. If you're going to image your system after installing patches and applications, I would wait until after creating your image to enable System Restore.

Install your Windows updates, applications, etc... Right now is a good idea to also make copies (perhaps on your C: drive somewhere) of the All Users start menu and your start menu. More on this later.

Once you have this done, use the latest Knoppix CD to create an image of your C: drive as a file on the ext3 partition you created before installing Windows. Just load Knoppix and run 'partimage' as root to create your image on the ext3 partition. It will spit out a warning that NTFS support is experimental. Ignore it, it works just fine.

Nice thing about using ext3 for this is that unless you load the ext3 utils for Windows, the ext3 partition will not be visible in My Computer so it helps to reduce the chance of accidentally removing the image of your OS. The downside is that you will not be able to back this up easily with your normal backup utility. There are many ways to handle this situation and it will be left as an exercise to the reader. (Hint: Knoppix has good network and data transfer tools.)

When you want to reinstall Windows, just load Knoppix and use 'partimage' to restore from image to partition and all of the above Windows Installation work will have already been done for you. Before using your "virgin" system, remember to restore your saved start menu folders and update it again with the latest security updates for your OS and all applications, including updating to the latest version of your applications (unless you specifically don't want to). Then use Knoppix/partimage to create a new image of your C: drive overwriting your old image. Using this method keeps you up to date and lets you reinstall windows to an "unused" state in a matter of minutes with all of your data intact. If you created your ext3 partition with enough capcity, you can have room to store more than one image of your OS. This can be good in case your latest image has a problem you didn't notice until after making the image. Unless you're installing some very large applications in your C: drive before imaging, you should be able to use 'partimage' with bz2 compression to store multiple images on your ext3 partition. This also assumes you did not enable System Restore before imaging. You can save a little extra space in your image by setting the security policy "Shutdown: Clear virtual memory pagefile" to "Enabled" before creating your image. You should be doing this for security concerns anyway. If you don't want to clear the pagefile on shutdown, then you can still save some space by moving the pagefile to your D: drive.

The Caveats:

  • Do this BEFORE you install any updates or applications on your system. I have never seen any system instability from applying these changes BEFORE installing updates or applications. However, in one case, one System Administrator did report instability when moving the user profiles AFTER installing updates and applications using the Windows XP profile move instructions on an XP system.
  • The files that were copied from C: are a pain in the butt to remove. They're just fine where they are and should not cause any trouble. Leave them there.
  • Any account that exists BEFORE you perform this change will not migrate to the D: drive, thus the reason for the temporary account.
  • This works on Windows 7 Ultimate Beta and Windows 7 Ultimate 64-bit. I have also tried this on Windwos 7 Home Premium and it works there with some minor changes in the user management steps. I will leave finding those details as an exercise to the reader. I have not tried any other versions of WIndows 7. I know that Vista uses a simliar if not identical user profile structure. I have not used Vista so I can't tell you if it works there or not.
  • This will not protect data stored in the C: drive (for instance, Save Game data that is stored in Program Files.) You will still have to back that up before re-imaging your C: drive. One option for dealing with this is to install your applications in your D: drive. While this will not solve all application reinstallation problems, it will at least keep your saved games and other data saved in third party "Program Files\Application_Name" folders from being lost during reimaging.