I’ve tried to Google this, and talk to others about doing it. What seemed to be such a simple request also seemed to be difficult to pull off. That’s when a brilliant (nearly the smartest man I know) told me about hard links & junction links in windows. Think of them like symbolic links in Mac or *nix systems.
- C:\dira linked to C:\dirb
- D:\dir1\ to C:\dir2\dir3
The great thing about using hard links in Windows is that it acts as if the data is still there. In the example above, when you’re browsing C:\dira the system will act as if you’re really in that directory when in all reality you’re browsing C:\dirb. Even the address bar will show that.
Thanks to an almost 3-year-old post on Lifehacker, I accomplished what I thought was only possible with tons of registry tweaking and tons of time spent in Safe Mode with a potentially unstable system afterward.
Real Reason Why
So the real reason I needed to so this is that I wanted to totally rebuild my system. New parts, new paint. Start from scratch and make this new Windows 7 installation as fast as it could be. Thanks to a good friend, I was given a small 30GB SSD. Now I could have run Windows on this just fine and had some programs installed there and others installed on another disk. Maybe even copied my music, downloaded programs, etc… to this other disk. But that requires that every time an installer runs I have to pay close attention to where it’s going. Every time a program wants to move data into the “My Documents” folder, I have to be mindful that I’m only dealing with about 18GB free after a clean install. That’s simply not enough. I’d run out in less than a few weeks and many times probably forget that these installers are putting all their files into the C:\Program Files directory.
So here’s the step-by-step instructions to moving just about any folder to another disk, especially those special Windows ones.
Install & Create Restore Point
- Install a fresh copy of Windows 7 (or XP or 8, whatever you want)
- Dont do anything else. Just leave it fresh and clean.
- Create a Restore Point (just to play it safe)
- Right Click “My Computer” and choose Properties
- Choose “System Protection”
- Select the “System Protection” Tab
- Click Create
- Type a description for this Restore
- Click Create
- Boot back up with the install DVD
- Choose the appropriate language, currency & keyboard and click Next
- At the screen where there is a large “Install Now” button, look just below it and click “Repair your computer”
- You might be asked if you want to “Repair and Restart”, choose No.
- Make sure that the OS that system recovery found is the one you just installed and that it’s selected. Click Next.
- You’ll be presented with a few options…choose “Command Prompt”
Now here’s where we really get our hands dirty. Well, not really, but just a bit.
Find out which drives are what.
Install Drive: DVD
OS Drive: Source
Secondary Drive: Destination
On my computer, it was:
X: DVD Install Drive
E: Actual OS SSD Drive
D: Secondary Hard Drive
Copy Data & Create Hard Links
So at this point, you need to copy all the source data to the destination drive and create the hard links.
Using my drive letters above, here is how its done.
- robocopy /copyall /mir /xj E:\Users D:\Users
- robocopy /copyall /mir /xj “E:\Program Files” “D:\Program Files”
- robocopy /copyall /mir /xj “E:\Program Files (x86)” “D:\Program Files (x86)”
/xj is very important as well as it tells Robocopy to now follow any junctions points it might meet when browsing these locations. Don’t Forget This
Now as long as no files failed to copy, we can proceed.
In order to create junctions or hard links, the source folder must not exist. This means that we now have to delete those directories we just copied.
- rmdir /S /Q E:\Users
- rmdir /S /Q “E:\Program Files”
- rmdir /S /Q “E:\Program Files (x86)”
Now we create the NTFS Junction/symlinks
- mklink /J E:\Users D:\Users
- mklink /J ”E:\Program Files” “D:\Program Files”
- mklink /J ”E:\Program Files (x86)” “D:\Program Files (x86)”
Now you’ve just moved all three of these folders from the Windows system disk to another disk.
Prove it to yourself
Now comes the proof. Change directories to E:\. Type dir and see what you see. You should see ” Users [D:\Users]”
Now restart your computer and you’re done.
A while after doing this Windows Update started failing on a few updates. I kept receiving the following error: Windows update error 80070011
I found that Microsoft® isn’t following those symlinks properly when it comes to certain security updates. I think had I only moved the “Users” directory all would be fine.
Google is my friend and I found out what needed to change in order for security updates to continue.
Basically, there are a few registry keys you’ll need to point to the “real” location of the Program Files directory because it wont follow the junction link.
Make these changes:
After these changes are made, Windows should be able to update successfully.