Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Thursday, October 27, 2011

SSDs and Windows 'Users' Directory

After getting my new SSD installed, I really wanted to get everything setup so that my data was safe on the 1 TB RAID 1 array.  This meant somehow moving the Users directory from C:\ (the SSD) to D:\ (the RAID).

The two main approaches are:

  1. Use an unattend.xml file during Windows installation to specify the Users directory.
  2. Move the Users directory after installation, and create a junction point at the original location to point to the newly located directory.  Here, the junction essentially acts as a symbolic link (although symlinks are a different thing in NTFS.)
After reading a ton of forum and blog posts, I decided to follow Marilyn O's advice on this question and decided to go with #2, because it is a single point of change, and should be easily reversible.

Here's how I got it working.  C: is my SSD where Windows is installed, and D: is the RAID array to which I'm moving my Users directory. Your drives/paths may be different.
  1. Install windows as usual.  Go a head and get the OS in a working state.

  2. Boot to a command line from the install media.  Follow these directions, but on the System Recovery Options dialog, click the last one, Command Prompt.

  3. Use robocopy to make an exact copy of Users to the new location:
    robocopy /mir /xj C:\Users D:\Users
    /mir makes an exact mirror, and /xj ignores junction points. Make sure to include these options!

  4. Verify that all the data has been successfully copied. Then, remove the original Users directory:
    rmdir /s /q C:\Users
    You really have to do this. See comment at the end for why.

  5. There is a junction named "Documents and Settings" (remember him from XP?) that currently points to C:\Users for compatibility purposes. We need to first remove him:
    rd "Documents and Settings"

  6. Now, make the new junctions pointing to the new Users folder on D: using mklink:
    mklink /j C:\Users D:\Users
    mklink /j "C:\Documents and Settings" D:\Users

    (Yes, Linux users, those arguments are in the opposite order.)

  7. Reboot and log in to Windows. If you look in C: in windows explorer, you should see that Users now has a shortcut overlay, indicating that it is a junction point:

Go ahead and play with it; files you make in C:\Users will be there in D:\Users.  Now granted, this may be a slight performance hit, because we have moved some important user files (ntuser.dat for example) onto the slower HDD.  In my opinion though, this is worth it, considering all of my user data is safe.  Additionally, I can back up the entire D: drive, and not worry about wasting space backing up Windows too.

Notes:

I originally just renamed C:\Users to old_users but this caused me to have another Users directory in C: when I looked in windows explorer!  And old_users was nowhere to be found.  But, everything looked okay from the command line.  I even copied it, and had the same results. So there must be some trickery going on that causes windows explorer to show it as Users. Deleting the directory made everything hunky-dory.

Monday, August 1, 2011

Windows 7 won't boot!

Well in a nutshell, here's how this problem unfolded, and came to be corrected.

New Install
I bought a pair of 1TB drives, and set them up in a RAID 1 array, using the VT8237A southbridge's built-in RAID feature. I left my old 200GB PATA drive in-place, so I could copy my files to the array. Then, I installed Windows 7 on the array, and everything was great. Until I happened to notice (while cleaning up) a new file: bootmgr on the old drive. A quick Google search told me that this was the Vista/7 bootloader. Crap! The brilliant installer decided to put the Win7 install on the new RAID array, where I specified, but put the bootloader on the old drive!

Steps:
- Unhook old drive, which renders system unbootable.
- Boot up Win 7 setup DVD, and select Repair (not install).
- Choose command prompt.

From Command prompt:
- diskpart
- list disk
- select disk 0
- list partition
- select partition 1
- active
- exit
(This marks the partition as active, which it was not before.  This is required for the BIOS to see it as bootable.)

Next, need to fix boot sector:
- bootrec /FixMbr
- bootrec /FixBoot
- bootrec /RebuildBcd

Then, close command prompt, and choose startup repair.  It may take once through for it to say fixed an error, then reboot. Then go back to startup repair. Here you should be able to run the automatic startup repair, and it will tell you that BOOTMGR was missing, which it will correct.

It now works for me, without the old drive!!!