Windows : create a missing recovery partition

 

When cloning a large hard disk to a smaller one, I lost the recovery partition. So far not bad, Windows works without recovery partition, but in case of an error the partition helps to get the PC up and running again. To summarize, here's how it works with the recovery partition: As long as the partition is still there, it can be deactivated and written to a file. If the partition gets lost unexpectedly, it can be recovered from the Windows setup media. This post is also available as a video, see: Youtube video.

Missing recovery partition

A look into the Disk Management, shows the partitions, Disk 0 has only one EFI system partition and the C drive:

The recovery partition can be loaded via Restore / Advanced Startup and "Restart now", among others:

If the recovery partition is missing, only the following 2 options are displayed in the Advanced options - Troubleshoot menu:

WinRe.wim vs. recovery partition.

If the recovery partition is not present, the content is normally located in the file: c:\windows\system32\Recovery\WinRe.wim.

The command: "reagentc /enable" in the command prompt uses the file WinRe.wim and fills the recovery partition with it. Conversely, the contents of the recovery partition can be written from the partition to the file with the command: "reagentc /disable". If neither the recovery partition nor the WinRe.wim file exists, the file can be copied from the Windows setup media:

Get the recovery partition from the Windows setup DVD.

Unfortunately, the Winre.wim file is not located directly on the setup medium, but hidden within the "install.wim" file. If you do not have a setup DVD to hand, you can download it from the official Microsoft site as an .iso file, see: Windows 10 / 11 - Download Installation - DVD or USB Boot

The easiest way to get the winre.wim file is 7-zip: Thanks to Thomas for the tip. With 7-zip, Winre.wim file can be unpacked directly from the downloaded Windows.iso file or another Setup Media: 
Path within the windows.iso-File: "\sources\install.wim\1\Windows\System32\Recovery\" or for certain media: "\sources\install.esd\1\Windows\System32\Recovery\"

Without 7-zip, winre.wim can be unpacked using the command "dism" in the command prompt:

c:\> mkdir c:\temp
c:\> dism /Export-Image /SourceImageFile:"F:\sources\install.esd" /SourceIndex:1 /DestinationImageFile:"c:\temp\install.wim" /Compress:none /checkintegrity
Without the /Compress:none parameter, subsequent mounting would fail:
Error: 11
An attempt was made to load a file with an incorrect format.

To load the contents of the file, we can use the dism command and the mount-wim parameter:

c:\> mkdir c:\temp\win
c:\> dism /mount-wim /wimfile:"c:\temp\install.wim" /index:1 /mountdir:"c:\temp\win" /readonly

After successfully loading the file, the Winre.wim is located in the specified folder c:\temp\win at c:\temp\win\Windows\System32\Recovery

The file can then be copied to the Windows folder: C:\windows\system32\Recovery\winre.wim

To unload the wim file we should use the following command after copying:

c:\> DISM /unmount-Wim /MountDir:"c:\temp\win" /discard

Creating the recovery partition

If the winre.wim file exists, the recovery partition can be restored as follows:

diskpart
DISKPART> list disk
DISKPART> select disk (DiskNumber from list disk)
DISKPART> list partition
DISKPART> select partition (Partitions Number from Drive c:)
DISKPART> shrink desired=700
DISKPART> create partition primary
DISKPART> format quick fs=ntfs label="winRE"
DISKPART> set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
DISKPART> exit
C:\WINDOWS\system32> reagentc /enable
REAGENTC.EXE: Operation Successful.

Set id changes the type of the partition to "Recovery". (Recovery-Partitions have this ID: de94bba4-06d1-4d40-a16a-bfd50179d6ac)

Start recovery partition

When starting the recovery partition via "Recovery", "Advanced startup", the reboot takes a little longer and the menu contains additional options:

FAQ

What is a recovery partition used for in Windows?

The recovery partition allows repairing or restoring the system in case of serious problems, for example, when the computer stops booting.

Can I delete the recovery partition to save space?

The recovery partition is not needed for normal operation and could simply be deleted. Please create a backup before the deletion. As an alternative to the recovery partition, the PC can be repaired or booted from a Windows boot media: DVD or USB stick in case of problems.

Can the recovery partition be moved?

With Windows tools, the recovery partition can be copied to a folder via the reagentc command and restored from there. This makes it possible to delete the recovery partition and create a new one at a different location. Alternatively, certain tools, such as "gparted", can be used to move the partitions.

Video

Conclusion

The recovery partition can be restored using the "reagentc" command. Alternatively, for a repair operation, the PC can also be booted via a Windows setup medium and repaired in case of problems, see: Windows 10 / 11 - Download Installation - DVD or USB Boot.

 

positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Updated: 2024-01-14 von Bernhard | Übersetzung Deutsch |🔔 | Comments:6

Read bios version, BIOS mode: UEFI or Legacy | Boot | Install Grub setup and set up Linux bootloader
Windows | Windows 11 23H2 (Build: 22631.3155) : show current version

Top articles in this section


the 4 best tools to compare two text files

Anyone who frequently creates scripts or analyzes log files and handles different versions can compare them very quickly with the help of the right editor. 


install driver via command line cmd: inf

Windows drivers can of course also be managed via the command line. Microsoft offers two different tools for this purpose: The PnPUtil integrated in Windows and as part of the Windows Driver Kit (WDK) the command: devcon.


Windows 11 23H2 (Build: 22631.3155) : show current version

Build means the kernel version of Windows. How current the Windows 10 or Windows 11 installation is, can be seen by the build number used.

Questions / Comments


(sorted by rating / date) [all comments(newest first)]

✍anonym
2023-07-04 11:34
Great article, thanks. I'd just like to add experience I had.
We have a server which was in-place upgraded  from Windows Server 2012 R2 to Windows 2019.
I did not realize the disk was MBR not GPT. Hence, when SET ID=de94bba4-06d1-4d40-a16a-bfd50179d6ac, I received

The specified type is not in the correct format.
For more information on the command type: HELP SET

The ID for MBR disks should be 0x27
set id=27

Official info from Microsoft
https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-setup-diskconfiguration-disk-modifypartitions-modifypartition-typeid

✍anonym
2024-01-12 23:02
Thanks for these instructions.
They helped me fix the error 0x80070643 when installing the KB5034441 security update on 3 different PCs (with winre.wim missing on some, but not on others...).
Judging by the amount of discussion on Microsoft's forum within the last few days, this error appears to be quite frequent (perhaps more common after SSD migration).
I found the instructions above a good complement to Microsoft's own KB article, especially for the case where the recovery environment is missing from your PC:
https://support.microsoft.com/en-us/topic/kb5028997-instructions-to-manually-resize-your-partition-to-install-the-winre-update-400faa27-9343-461c-ada9-24c8229763bf
--mgroeber9110

✍Jeff
2023-01-04 03:25
Hello,

Thank you for the clear step-by-step instructions. I do have one question: In creating the recovery partition, you use "create partition primary" which makes a partition "NTFS  Basic Data Partition." But other recovery partitions are simply "recovery partition." Will this new partition still be recognized as a recovery partition upon advanced boot?

Thanks!

Jeff
✍Bernhard
comment date 04.01.2023 08:09
Hello,

yes it will be recognized, I tested it using Advanced startup.

created by Bernhard

✍anonym
2023-08-07 06:25
Thank you for your article.
I did a clean install of Windows 10 LTSC 2019 on my old PC with an old BIOS. I deleted all the disk partitions and I clicked next to start installing Windows. In the end, I only had 2 partitions. The "System Reserved" & the "Partition C:".
Since my system is not GPT, the "set id" command gave me an error. So, I changed the "set id" command  to equal the number 27. After that I succesfully created the lost Recovery Partition. Now the Recovery Partition works as it should.
But ... the "Windows System Image" backup tool does not include the Recovery partition when creating the System Image...
You know why ?

✍anonym
2023-04-19 20:56
i got to the last step "reagentc /enable" and i get the error "REAGENTC.EXE: Windows RE cannot be enabled on a volume with BitLocker Drive Encryption enabled."

By continuing to browse the site, you agree to our use of cookies. More Details