Sunday 17 July 2011

HOWTO: Move the Users-tree to another drive in Vista/Windows 7

WHY MOVE THE C:\Users -TREE TO ANOTHER DRIVE?

Why would someone want to move the C:\Users-directory tree to another drive?
One reason: Storage Capacity.

Windows Vista and 7 store all user- and shared data under the C:\Users -tree and therefore a fast system drive like a smallish SSD or a Velociraptor will inevitably lead to the filling of the whole C:\ -drive because user data like home videos and digital pictures will consume easily hundreds of gigabytes of storage space.

So say you've invested in a fast 64GB SSD-drive and would like to play World of Warcraft and tryout the occasional Public Test Realm versions of it. Your WoW-installations alone will consume 35GB of your limited storage capacity and ass Windows Vista/7 data at about 15-20GB and a few hundred RAW-images and you're out of space badly.

Installing Windows Vista or Windows 7 will replace the old 'Documents and Settings' directory tree as the repository of system users home directories as well as the shared Public-directories like C:\Users\Public\Games\World of Warcraft.

Unfortunately the directory tree contains the user registry and other system files so you cannot just move it to another drive and walk away with a working Windows installation.

As a matter of a fact, your Windows won't be able to logon if something gets screwed-up during the following instructions. -> So make a full image backup NOW!

STEP-BY-STEP INSTRUCTIONS

Here are some step-by-step instructions on how we do this - I don't claim authorship to any of these - I collected the different ideas together that were floating around the blogosphere and tried the different methods until I got it right.

1. Make a full backup image of your system drive (C:\) before you proceed

I found out the hard way that System Restore CANNOT restore a broken linkage of C:\Users nor will renaming the original directory back to its original name fix the error that Windows will crash & burn with if something goes awry.

So you'll want to make a full system backup-image with the Windows Vista/7 Backup/Restore -tool or another similar backup utility that support full volume imaging to get back up after a failed attempt.

2. Make a System Repair Disc with the Vista/7 backup tools for yourself or have the install DVD handy for command shell

Start Control Panel -> System and Security -> Backup and Restore -> Create a system repair disc. You will be asked to insert a CD or DVD into your DVD-burner (either will work since the image is small enough to fit on a normal CD-R disc). Make the disc and label it.

Alternatively, albeit a slower way of getting to a command shell is to boot from the original installation media and select 'Repair system' from the installation menu -> Use recovery tools -> Command Prompt.

3. Make sure your second drive where you're relocating the C:\Users -tree is in such a place that it will be given the same drive letter during a System Repair Boot as it has during normal boot.

This is imperative since the hard linking used in the guide requires you to be able to give the whole drive path including the destination drive letter to link to the new destination and this will fail if the drive letter during SysRepair is different from normal runtime.

In practice this means you need to make the secondary drive the D:\ -drive since the SysRepair command shell will boot to X:\ itself, have an empty C:\ -drive, D:\ will be in its normal place and the ordinary boot drive will be located at E:\ in a two hard drive and a DVD-drive scenario.

I found out this the hard way too with the secondary drive mapped to Z:\ normally and during the System Repair command shell it would end up being D:\ and mess the linkage totally and result in a full restore.

4. Boot into the command shell with the System Repair disc or your original Windows intallation DVD and do the following:

1. Type 'E:' and press 'Enter' to go to your normal boot-up drive
(this may be a different letter if you have a different drive configuration)

2. Type 'robocopy E:\Users D:\Users /MIR /E /XJ /COPYALL DCOPY:T'
(possibly also 'robocopy E:\Users D:\Users /MIR /E /XJ' will be enough - tried both when I succeeded) and press 'Enter'

3. Type 'rmdir /S /Q E:\Users and press 'Enter'

4. Type 'rmdir E:\"Documents and Settings" and press 'Enter'
(Documents and Setting is a hidden hard link (Junction) to C:\Users that won't work if it is pointed to a hard link Junction)

5. Type 'mklink /J Users D:\Users and press 'Enter'
(Note: here the originating link point i.e. C:\Users must and can be given as a relative reference without a drive letter so it can be done even thou the C:\-drive will reside as E:\ -drive during the System Repair command shell.)

6. Type 'mklink /J "Documents and Settings" D:\Users and press 'Enter'
(Note: Same goes for this relink. Also here we link Documents and Settings directly to the real new Users-directory tree to avoid the nested linkage.)

7. Type 'Exit' and press 'Enter' to exit the command shell
8. Reboot the computer normally and you should have a working hardlink to D:\Users from C:\Users and all the space consuming data will end up on the secondary larger drive transparently to the OS.

There are some rumors that this linkage might confuse some backup utilities to make an image backup of both drives and breaking the image doing that.

No comments:

Post a Comment