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
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)
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)
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.
- Open the command prompt with admin privileges and run the following commands:
- Type diskpart
- Sel disk 0
- create partition primary size=450
- format quick fs=ntfs label="Recovery tools"
- assign letter="R" (This is assuming that the drive letter R is not already in use)
- 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.
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'?>
<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"/>
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
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.
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.
Now you know how to customize the recovery partitions. For more information, please refer to the article:
I hope this was helpful.
Windows Devices and Deployment Team