Friday, May 28, 2010

Problems with Windows 7 and Windows Home Server Backup

For some unknown reason, the Windows Home Server backups on my primary workstation started to fail. I started getting warnings through the WHS connector software. Going into the Backup Details on WHS gave me the error "The computer failed to take a snapshot of the volume for backup."

After quite a bit of digging around, it seems most of the time this error is in relation to an additional Volume Shadow Copy Service (VSS) installed from programs such as Norton Ghost. They tend to cause problems. I used the command vssadmin list providers and the only thing that showed up was the default VSS provider from Microsoft. My next idea was to try chkdsk, however chkdsk /f /r didn't fix anything.

Finally, after reading more into VSS, I found that it needs around 40 megabytes of free space on the partition to take the snapshot and do it's work. This got me to thinking about the 100 megabyte System Reserved partition that comes in a fresh install on Windows 7. After looking at properties on the partition, I only had 36MB free space. Definitely a problem! It's a bit cryptic as to what is exactly stored in this partition besides a recovery environment, some bitlocker stuff, and files required to boot, so you can't just go in willy nilly and delete files. I changed the backup settings to ignore the 100MB partition and backups were back to working perfectly. This, however, isn't a good idea. As I said, the 100MB partition holds some important files for booting so having it backed up along with the rest of your data is definitely a good thing.

I still don't know the root cause of why the partition got so full in the first place, but it was definitely the cause of my backups failing. After a lot of searching and reading, everything I found had a different reason for the partition growing, usually related to 3rd party software. Nothing matched what I was seeing, so I gave up on trying to find a cause and started to figure out a fix. So, what options do we have? There's a few:

Option 1: This is the easiest. If you have unused space right after the System Reserved partition, you can just right click it in Disk Management and click Extend Volume. Extend it enough to give yourself more than 40MB free space on the partition, but don't go over 500MB. It seems there's there's an upper limit to the size this can be. Anywhere between 200-400MB is more than sufficient.

Option 2: This is probably the one you'll have to use. If you don't have contiguous space on the drive that can be used for expansion, you can shrink one of the primary partitions and create a new System Reserved partition in the new space. Once again go into Disk Management. Right click the C partition or any other, and Shrink Volume. Shrink it by you're chosen amount of less than 500MB but more than 100MB. The next step is to right click the newly created partition and format it as NTFS. Then right click again and give it a drive letter. I gave mine the letter F. Now we're ready to copy the files you'll need. You'll have to open a Command Prompt as Administrator and run the following command. This assumes C:\Windows is where your Windows install resides, and you lettered the new partition F.

bcdboot C:\Windows /s F:

This copies all of the files over to the new partition that you'll need to boot. Before you reboot, though, you need to right click the new partition for the last time and Mark Partition as Active.

Optionally, if you found the reason for the original System Reserved partition filling and have since fixed it, you can repeat the above process in reverse. Just copy all of the files back to the original partition. Then, set it as active, delete the new partition, and expand the one you shrank. Everything would then be back to how it was during the fresh installation.

Option 3: Do a complete reinstall of the operating system. Not something I would suggest, but there's a few tweaks you can do during a fresh install to have boot files reside in the Windows partition instead of on it's own separate one. Follow the guide here if you're obsessive about these things.

That's it! Personally, I had to go with Option 2. After following the steps, I only had 32MB of used space on the new partition. I enabled backups on the new partition and all was well with the world. A few weeks later, out of curiosity I checked properties on it again and still only 32MB of space was being used. This makes me assume that in my case, whatever caused it to fill up in the first place seems to be a problem that has resolved itself. So, I reversed the process in Option 2 and put everything back in the original 100MB partition. I've yet to see the problem again.

Microsoft is aware of this whole deal, but it's unclear as to exactly what they plan on doing to resolve it. I found a thread in the Microsoft forums that pertains to the same issues with people doing local backups and getting error codes 0x81000019 and 0x80070002. A couple of Microsoft employees were active in the discussion. The problem is that it originated during the RC phase of Windows 7 development and is still active with no all encompassing solution in sight. I'm hoping they're working behind the scenes to put out a patch that solves the issues.