Deploy Windows RE on system partition

I have been fighting with REAgentC to allow me to install the WinRE image to the system partition (8).

I have gone through numerous errors like »the product has been uninstalled«, »there is insufficient space on the device«, »the operation cannot be completed due to a file system limitation« and the pair of »cannot find the file/path specified« or »file cannot be created because it exists«.

I think the »cannot be created« error was the result of copying an existing boot.sdi ramdisk along with the winre.wim. This is wrong, REAgentC creates the ramdisk.

One thing I've noticed is that at least on an MBR disk, an NTFS partition is required in order to successfully enable WinRE on the system partition. If it's FAT32, I got misleading errors about »insufficient space« until I enlarged it, which then told me it could not complete the operation due to »file system limitations.«

If REAgentC is confused by the current contents of %systemroot%\System32\Recovery\ReAgent.xml, replace by a blank file:

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version="1.0">
    <WinreBCD id=""/>
    <WinreLocation path="" id="0" offset="0"/>
    <ImageLocation path="" id="0" offset="0"/>
    <OsInstallLocation path="" id="0" offset="0"/>
    <InstallState state="0"/>
    <OsInstallAvailable state="0"/>
    <WinREStaged state="0"/>
    <OperationParam path=""/>
    <OsBuildVersion path=""/>
    <OemTool state="0"/>
    <BootKey state="0"/>
    <IsServer state="0"/>
    <ScheduledOperation state="4"/>
</WindowsRE>

With the recovery partition on R:, the commands

md r:\Recovery\WindowsRE
xcopy /h %systemroot%\System32\Recovery\winre.wim r:\Recovery\WindowsRE
reagentc /setreimage /path R:\Recovery\WindowsRE /target %systemroot%
reagentc /enable
succeed and eventually produced this file:

<?xml version='1.0' encoding='utf-8'?>
<WindowsRE version="1.0">
    <WinreBCD id="{30f4463f-add1-11e4-97b2-e8db73286102}"/>
    <WinreLocation path="\Recovery\WindowsRE" id="196858822" offset="1048576" guid="{00000000-0000-0000-0000-000000000000}"/>
    <ImageLocation path="\Recovery\WindowsRE" id="196858822" offset="1048576" guid="{00000000-0000-0000-0000-000000000000}"/>
    <OsInstallLocation path="" id="0" offset="0" guid="{00000000-0000-0000-0000-000000000000}"/>
    <InstallState state="1"/>
    <OsInstallAvailable state="0"/>
    <WinREStaged state="0"/>
    <OperationParam path=""/>
    <OsBuildVersion path="7601.18700.amd64fre.win7sp1_gdr.141211-1742"/>
    <OemTool state="0"/>
    <BootKey state="0"/>
    <IsServer state="0"/>
    <ScheduledOperation state="4"/>
</WindowsRE>

Note that it's apparently impossible to issue the »/enable« command from Recovery Environment because it doesn't support the »/target« switch.

And here are the relevant boot loader entries created by REAgentC for this case:

Windows-Start-Manager
---------------------
Bezeichner              {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  de-de
inherit                 {globalsettings}
default                 {current}
resumeobject            {30f44639-add1-11e4-97b2-e8db73286102}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30

Windows-Startladeprogramm
-------------------------
Bezeichner              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  de-de
inherit                 {bootloadersettings}
recoverysequence        {30f4463f-add1-11e4-97b2-e8db73286102}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {30f44639-add1-11e4-97b2-e8db73286102}
nx                      OptIn
detecthal               Yes

Windows-Startladeprogramm
-------------------------
Bezeichner              {30f4463f-add1-11e4-97b2-e8db73286102}
device                  ramdisk=[\Device\HarddiskVolume1]\Recovery\WindowsRE\Winre.wim,{30f44640-add1-11e4-97b2-e8db73286102}
path                    \windows\system32\winload.exe
description             Windows Recovery Environment
inherit                 {bootloadersettings}
osdevice                ramdisk=[\Device\HarddiskVolume1]\Recovery\WindowsRE\Winre.wim,{30f44640-add1-11e4-97b2-e8db73286102}
systemroot              \windows
nx                      OptIn
winpe                   Yes

Geräteoptionen
--------------
Bezeichner              {30f44640-add1-11e4-97b2-e8db73286102}
description             Ramdisk Options
ramdisksdidevice        partition=\Device\HarddiskVolume1
ramdisksdipath          \Recovery\WindowsRE\boot.sdi

For the tools to work, the system and recovery partition must be type id 0x27 on an MBR disk. The MBR and GPT partition types are:

Recovery300MBNTFS0x27de94bba4-06d1-4d40-a16a-bfd50179d6ac
ESP100MBFAT320x27c12a7328-f81f-11d2-ba4b-00a0c93ec93b
MSR128MBNTFS0x7e3c9e316-0b5c-4db8-817d-f92df00215ae
OSNTFS0x7ebd0a0a2-b9e5-4433-87c0-68b6b72699c7

Other tools

Helpful tools I've used (apart from REAgentC and bcdedit, obviously) include bcdboot %systemroot% /l en-us /s s: to copy the required files to the boot partition and set the desired locale and the Recovery Environment commands bootsect /nt60 %systemroot%, bootrec /fixboot and bootrec /fixmbr (the latter apparently Windows XP relics) to restore a partition's boot loader.

Comments