The other week I mentioned I'd suffered a hard drive failure on my laptop. Other than the git issues I wrote about last time, I had another issue that seemed worth writing up: How to get all of the user data for the rebuilt install on a separate drive to the programs and operating system. If that's something you might want to do with a Windows install then read on...
I've been using a machine running Windows Server Essentials as a home server for some time, and this manages the backup of my individual PCs. Something I realised with the recent hard disk failure was that it's rare that I'd want to restore the whole drive. The reality is that I usually want to re-install the O/S and applications to a blank drive, and then restore only my data files and some settings from backups. Hence using Windows Server Essentials to back up the entire drive is largely wasting disk space and making the backups take much longer than necessary.
So I started researching how I could configure my rebuilt machine to get my user data onto a separate volume, and back up only that bit.
You can move many of your user folders about via the Windows UI. For example, if you right-click your "Documents" folder you can adjust the path via the "Location" tab:
While this is easy, it's not that great a solution. Firstly, it doesn't address any of the settings and data stored in any of the hidden folders that Windows keeps under your Users folder. You're moving some of the child folders of your User folder, but nowhere near all of them. Also some (poorly written) applications which make assumptions about where these folders are supposed to live won't respect the settings here, and will keep writing to the old location anyway.
So what else can we do?
If you're prepared to sort this out when you're in the process of installing Windows, then you can do better than the simple approach. After spending some time with Google, I came across an article describing how to physically move all of the "Users" folder, and then fool Windows into thinking it was still in the right place using directory junctions. The process I tried came from this article, however I found that the precise approach described there didn't work for me. Here's what I did instead:
xcopy "E:\Users" "D:\Users" /e /i /h /k /y /c
rmdir "E:Users" /s
mklink /j Users "D:\Users
Those three commands should end up looking something like:
If all goes well, the installation should now complete (after you've answered a few more questions) and Windows should run fine. When you look at Explorer you should see something like:
Note how the Users folder here has a "this is a link" icon overlay, showing what we've done.
And with that sorted out, I can now tell the Windows Server Essentials connector software to back up the
drive only, so just my files and settings are copied.
I did find one scenario where the steps above don't work quite so easily. That is where the drive letter of your data volume gets changed between you creating the link above, and the installer continuing after rebooting. This seems to happen in some scenarios where the installer sorts the volumes differently to Windows itself – specifically for me it happened on a laptop which had an MSATA SSD and a SATA HDD. The installer sorted the volumes on the MSATA drive before those attached to the SATA drive, but when Windows was running it put them the other way around. If this happens to you, it will cause the installer to put up an error dialog and stop because trying to write to the fake
directory junction will fail.
Should you see this error, you can use Shift-F10 to get the command prompt back, and adjust the link. Use
to remove the incorrect directory junction record. Then repeat the
command to point a new link to the correct drive letter. Rebooting again should allow the windows installer to complete.
If you're worried about getting this process right (or you just want to practice), you can test it out in a virtual machine.↑ Back to top