Customizing the recovery partition after upgrading the OS from Windows 8.1 to Windows 10

 

Hi Everyone, my name is Suganya and I am from the Windows Devices and Deployment Team. I would like to discuss one of the common issues customers face today; “Customizing the recovery partition after upgrading from Windows 8.1 to Windows 10”.

What is Windows RE and why is it used?

The Windows Recovery Environment (Windows RE) is a recovery environment that can repair common causes of unbootable operating systems. Windows RE is based on Windows Preinstallation Environment (Windows PE), and can be customized with additional drivers, languages, Windows PE Optional Components, and other troubleshooting and diagnostic tools. By default, Windows RE is preloaded into the Windows 8.1 and Windows Server 2012 R2 installations. (For more information please refer to the following article:

Windows Recovery Environment (Windows RE) Overview
https://technet.microsoft.com/en-in/library/hh825173.aspx

Consider the following scenario:  You are planning an upgrade from Windows 8.1 to Windows 10.  Before upgrading the OS, you see the following partitions in the diskpart:

  • System reserved partition (350 MB)
  • OS partition (126 GB)
  • Recovery partition (300 MB)

image

After the upgrade you see the following partitions:

  • Recovery partition from the old OS (300 MB)
  • System reserved partition (350 MB)
  • OS partition (125GB)
  • New Recovery partition (450MB)

clip_image003

Now we have two recovery partitions, but we would like to only have one and customize the partition based on our requirements.

Delete both of the current recovery partitions on the drive and follow these steps to create a new recovery partition and customize it.

  1. Open the command prompt with admin privileges and run the following commands:
    1. Type diskpart
    2. Sel disk 0
    3. create partition primary size=450
    4. format quick fs=ntfs label=”Recovery tools”
    5. assign letter=”R” (This is assuming that the drive letter R is not already in use)
  2. Create the folders “Recovery” and “WindowsRE” on the R:\ drive.

 

Use the Windows 10 ISO to copy the winre.wim to a local drive using the following command:

  • dism /mount-wim /wimfile:”D:\sources\install.wim” /index:1 /mountdir:C:\test\ /readonly

You will now have the winre.wim file in the following location: “C:\Test\Windows\System32\Recovery”

  • Copy the winre.wim to the c:\perflogs folder
  • Unmount the image with this command:  dism /unmount-wim /mountdir:c:\test /discard

Note: This is an example as drive letters may differ in your environment. Verify drive letters in WinRE with Diskpart.

  • Copy the Winre.wim to the “R:\Recovery\WindowsRE” folder.

Now, to configure the Windows® Recovery Environment, run the following command.

  • reagentc /setreimage /path R:\Recovery\WindowsRE

Now if you run the command “reagentc /info” from a command prompt it shows the Status as Disabled.  When you enable it using the command “reagentc /enable”, the Status will still show as Disabled.

clip_image005

This can happen if the Windows Boot Loader is not updated with the correct device information.  You will have to edit the recovery.xml which is located in C:\WINDOWS\SYSTEM32\RECOVERY as it contains the older WinRE and OS image configurations.  You will have to give everyone full control for the XML file before copying the following lines to the file.

Reagent.xml should be edited to reflect these changes:

<?xml version=’1.0′ encoding=’utf-8′?>

<WindowsRE version=”2.0″>

<WinreBCD id=””/>

<WinreLocation path=”” id=”0″ offset=”0″/>

<ImageLocation path=”” id=”0″ offset=”0″/>

<PBRImageLocation path=”” id=”0″ offset=”0″ index=”0″/>

<PBRCustomImageLocation path=”” id=”0″ offset=”0″ index=”0″/>

<InstallState state=”0″/>

<OsInstallAvailable state=”0″/>

<CustomImageAvailable state=”0″/>

<WinREStaged state=”0″/>

<ScheduledOperation state=”4″/>

<OperationParam path=””/>

<OsBuildVersion path=””/>

<OemTool state=”0″/>

</WindowsRE>

Copy the edited reagent.xml to R:\Recovery\WindowsRE.  You will need to set the location of the Windows RE boot image using the following command:

  • Reagentc /setreimage /path R:\RECOVERY\WINDOWSRE /target c:\windows

clip_image006

When you run the command “reagent /info”, you will still see the Status as Disabled.  When you run the command “reagentc /enable”, the Windows RE Status will now show as Enabled.

clip_image008

Also when you check the output of the command “bcdedit /enum all”, you can see that the windows boot loader is updated with the correct device information.

clip_image010

Now you know how to customize the recovery partitions.  For more information, please refer to the article:

Windows PE (WinPE)
https://msdn.microsoft.com/en-us/library/windows/hardware/dn938389(v=vs.85).aspx

I hope this was helpful.

Suganya Natarajan
Technical Advisor
Windows Devices and Deployment Team