Monday, August 22, 2011

How to archive a Client PC backup from Windows Home Server Backup

Situation:

You want to clean up the console from not longer used computers, but you do not want to lose the last backup done from that machine. Or you want to preserve an important backup without the risk of losing it in case of a corrupted backup database in the future. Since Windows Home Server does not support archiving, you would either have to save the entire backup database or keep the unused computer forever in the console.

This FAQ describes an unsupported method to archive single volumes from a PCs backup using Microsoft imaging technologies used for corporate deployments. Be warned, that this requires some basic technical understanding of drive imaging and that misinterpreting information given here may have negative effects to your client PC. Also details may vary for the operating system used and for the version of Windows AIK. This FAQ has been tested on a Windows 7 Ultimate client PC with WAIK 3.0.

Prerequisites:

· A running Windows Home Server client PC.

· Windows Automated Installation Kit (Windows AIK), which can be downloaded from Microsoft. Select a version, which is compatible to the client PC on which you want to perform the task.

· Enough disk space on a local disk, an USB drive or a network share to store the archived volume(s).

· The freeware tool GImageX for more convenience.

· The capability to open the backup using the Windows Home Server Console.

Limitations:

· You can only save and restore one volume at time, so saving or restoring multiple volumes is a sequential process. Limitations for restoring to different hardware apply as with Windows Home Server – a restored operating system could fail to boot, if the HAL or the disk layout/needed controller drivers on the target computer are different.

· Without the freeware GImageX you will have to perform all tasks in the command line.

· There is not much consistency checking, so carefully check your selections before applying anything to the wrong target location.

· The Windows Home Server Console on the client must be able to mount the backup and the backup must be completely readable.

Archiving a volume:

1. Download and install Windows AIK on a client PC.

2. Download and extract GImageX.

3. From the folder C:\Program Files\Windows AIK\Tools find the tools for your client OS architecture (x86 or x64) and copy following files to the same folder, in which gimagex.exe is stored:

wimgapi.dll

wimmount.inf

wimmount.sys

WimMountInstall.exe

wimserv.exe

imagex.exe

4. Open GImageX by double click (no installation needed).

5. In the Windows Home Server Console open the wanted backup of a volume you want to archive.

6. In GImageX on the Capture tab click Source and select the mounted volume containing your backup (usually Z:).

7. For Destination enter a path and a file name. The extension of the file is .wim. Wim files are file based images, which offer the benefit against Windows Home Server, that you can restore them also to smaller than the original volumes.

8. Assign a name to the image in the Name field and add a Description for the image file.

9. Select the wanted Compression rate (recommended: Maximum).

10. The other fields and checkboxes are not of high interest for the intended purpose.

11. Click Create to start the creation of the image file.

12. If you want to attach a second backup (i.e. another volume of the same PC) to that wim file, you can do this by clicking Append instead of Create.

Command line example:

If you like to use the command line for creating / appending the image, you can do this by opening the Deployment Tools Command Prompt from Start menu and entering the following commands (adjust them to your configuration):

imagex /capture Z: d:\test\whsbackupxp.wim “XP Workstation Drive C: 01/2010”

Optional to append another mounted backup (assuming again Z: as drive letter):

imagex /append Z: d:\test\whsbackupxp.wim “XP Workstation Drive D: 01/2010”

Hint: If you archive multiple PCs into one image by appending, you will often find, that the image file does not increase that much. This is the result of single instance storage, which stores only one copy of duplicate files.

You can store the created wim file on a shared folder on the server, on the client PC or on external disks and delete the old PC from the console, after you did save all volumes you intend to keep and validate, that your archive works as intended.

Mounting a wim file:

In the most cases you do not want to restore a complete old PC, but only single files or folders. To do so:

1. Create an empty folder on your local disk and open the GImageX tool.

2. Select the Mount tab.

3. Declare the empty folder as Mount Point.

4. Select your wim file as Source. The file can be located on any volume or network share, to which you have access.

5. If you have only one image in your wim file, select image number 1, if you have multiple, you can get the number from the Select dialog (here you meet the name and description from the Capture screen again).

6. Select the check box Read and Write, if you want to add, change or remove files from the wim file, otherwise leave it unchecked.

7. Click the Mount button. After a while (I got the feeling, using the command line tool is performing better) the mounting will be completed.

Command line example:

imagex /mount d:\test\whsbackupxp.wim 1 d:\mount

would mount the first image stored in the file whsbackupxp.wim from the location d:\test to the empty folder d:\mount. For mounting with Read and Write access you would use the parameter /mountrw. Windows 7 users can also use the command line tool dism.

Now you can open the mount point folder in Windows Explorer and access all files, which are stored in the image, dependent from the Read and Write selection copy, change, delete or even execute them.

Hint: Deletion of files and folders does not reduce the size of the image automatically. You would have to export the image to a new wim file to get a smaller image file after committing the deletion.

Unmounting the wim file:

After completing the operations you should unmount the wim file:

1. Close all open instances of the mounted image in Windows Explorer or command prompt.

2. On the Mount tab in the Unmount section select the mounted image(s) and click the Unmount button.

3. If you wish to save changes in an image mounted as Read and Write, select the Commit Changes checkbox.

Command line example:

imagex /unmount d:\mount

would unmount the image file from the mount point. The additional parameter /commit would be needed to finally write any changes made directly in the image.

Performing a full volume restore:

Bare metal restore is one of the powers Windows Home Server offers to end user. A wim file can also be used to perform this task:

1. Attach the disk, to which you want to restore the data, to the client PC as secondary drive or using an USB to IDE/SATA converter cable.

2. Create the volumes you need on this disk either by using disk management console or the diskpart command. If there are already volumes on the disk, it is recommended to format these volumes before starting a restore to them. The size must at least match the size of the total amount of data to restore.

3. Open GImageX and select your wim file as source.

4. As destination select the drive letter (or an empty folder), to which you want to restore all files from the volume.

Attention: Be carefully, because a wrong target selection can mess up the selected target volume. So it is not a good idea trying to apply the image to the current C: drive or another disk with data on it (with the exception of an empty folder as target).

5. Select the proper image from within the wim file to restore.

6. Restore further images to additional volumes on the disk, if needed.

Command line example:

imagex /apply d:\test\whsbackupxp.wim 2 f:\

would restore the second image stored in the file whsbackupxp.wim from the location d:\test to the root of a volume, which uses the drive letter f: in the currently running operating system.

If you want to boot a PC from the restored disk later (or try at least, if the hardware does not match the original configuration any more), set the volume active either in the Disk Management Console or with diskpart:

diskpart

select volume f: (use the drive letter assigned to the volume, which you want to make active)

active

Attention: Selecting the wrong partition here may render the current PC unbootable.

Hint: If you have a license of Windows 7 or Vista, you could also create a Windows PE based boot medium, copy the mentioned files to that medium and perform the restore from there directly on the target PC (assuming the drivers to access the disk are loaded (which is likely in Windows 7 PE), the volumes are created with diskpart or are still existing) and the wim file is accessible from a local drive or via mapped network share. For this you can use the cmd prompt in Windows PE, which can be opened with the shortcut Shift + F10.

Side effects:
A user, who restored his system that way found two side effects, which may cause issues, if you restore a operating system volume from it:

1. NTFS permissions.

As it seems, the metadata in the opened WIM file does not contain the special ACLs set to files and folders, i.e. for Windows 7/Windows Vista the Trusted Installer account on system folders or user ACLs on the profile folder. Therefore these will not be saved and not be restored automatically. This can be done later manually (for some Windows versions you find also commands to restore the default permissions -but still missing such information for Windows 7). The ACL restore for Windows XP with SP3 and Vista is explained in KB313222.

2. Drive Letter of Windows Volume

This can happen not only using that specific restore method, but also in other restores or cloning attempts. Sometimes the restored operating system will grab a different drive letter for it's system volume. This manifests itself by many of the Windows shortcuts and programs not functioning, including regedit and cmd prompt. You can fix this by booting from a Vista or Windows 7 DVD and editing the registry of the restored system (or attaching the disk to a running Windows version as secondary drive and using the running OS on that machine):

  1. In the computer repair section of the Windows PE environment on the DVD open Command Prompt.
  2. Start regedit (if in a running Windows Vista or 7 with UAC enabled, start regedit as Administrator).
  3. Navigate to HKEY_LOCAL_MACHINE.
  4. Click File/Load Hive, navigate to the folder Windows\system32\config on your recovered OS partition and open the file SYSTEM.
  5. Assign a name to the structure (i.e. TEMP) and find the key HKEY_LOCAL_MACHINE\TEMP\MountedDevices.
  6. Assuming, your original system had the drive letter C: and now is assigned to drive F:, you would now rename the entry \DosDevices\C: to a free letter and then \DosDevices\F: to \DosDevices\C:. Former and current drive letters may be different on your system.
  7. If you mounted the registry hive in a normal Windows environment, navigate back to the TEMP key and click File/Unload Hive. (In Windows PE this action is not necessary.)
  8. Now try a reboot. If the drive letter is correctly assigned, the programs will start properly again. Product activation may still be triggered.
http://social.microsoft.com/Forums/en-US/whsfaq/thread/cb96541b-4fb1-4364-a72c-2eb64d265bea