Sunday, June 3, 2012

How to restore SBS 2008 backup after hardware crash

The following solution is about Small Business Server 2008 (with Exchange Server 2007), but it sould work (not tested) with other versions of Exchange.

Suppose your Small Business Server 2008 crashed unexpectedly and you couldn't start it by any means.
If you have a full backup you are in luck, but unfortunately it's not that straight forward to recover data.
The official disaster recovery procedure says you should use the first setup disk (dvd 1) and choose the repair option to restore the full machine. It's also called "Bare metal recovery", but unfortunately it seems that it doesn't always work and you might end up with an error saying that the backup is corrupt, although I could easily open the .vhd's in the backup folder using Disk Manager (diskmgr.msc) and copy/open files directly.

In very few words, if you encounter the above error when trying the official disaster recovery option, my solution consists in:
1. Install a clean SBS server in virtual environment (I used Hyper-V).
2. Create partitions for each of the partition on the original server, at least the old size.
3. on the host Hyper-V server, attach both the new machine's .vhd and the vhds from the backup.
4. Take ownership of both source partitions and destination partitions (recursive) and then recursively set permissions so that the local Administrators group has full access.
5. Use xcopy with /J /B /Y /K /H /G /E /C flags to copy important folders from the backup VHDs to the target VHD. Important folders would be:
  1. Windows
  2. Program Files
  3. Program Files (x86)
  4. ProgramData
  5. inetpub
Some files will issue an Access Denied error, but in my case they were not important for the restore.

6. Start the virtual machine

After a restart needed because of hardware changes you should be up and running. I'm not yet aware of the implications of forcing ownership of all files to the Administrators group and also recursively setting permissions on all files. Another repair, this time with the tool recognizing the installation might solve the permissions, but I've not yet tested this.

From this point you can export PST files from mailboxes, download documents from SharePoint or event continue to use the server as you did before.