Extend Volume Blocked by a Recovery Partition on Windows 10

One day I saw in one of my virtual test machines that there was no free space left on system drive C:. I increased the disk size in the virtual machine settings and switched to the guest OS (Windows 10) to increase the size of the system partition with unallocated space. When I opened the Disk Management Console (diskmgmt.msc), I noticed that there were two recovery partitions on the disk. And the unallocated space appeared after the second recovery partition (marked Windows RE). For some reason, the recovery partition is behind the primary partition (C:) and you cannot expand the primary volume with unallocated space. In this article I will discuss two different ways to remove and restore the recovery partition for EFI and BIOS computers. Before you begin the following steps, please familiarize yourself with your computer’s architecture. It is also highly recommended that you back up (or snapshot) your critical data before trying to make any changes to your partition table.

How do I migrate system partition recovery and expansion to a UEFI-based computer?

My virtual machine has Windows 10 installed in UEFI mode (party style: GPT).

 

As you can see in the screenshot below, the Stronger button is inactive (grey). You can expand a partition using the built-in Windows programs if there is unallocated space to the right (Windows 10 cannot expand the main partition to the right of the allocated space). In my case, I cannot refresh my C: drive because it is locked by a recovery partition (Windows RE). So I’ll have to delete the recovery partition before I expand the size of the system partition.

 

The screenshot shows that there are two partitions to restore (Restore and Windows RE). To understand which one is used by Windows as the active recovery partition, you need to assign drive letter to the partitions. For example B. Assign the station letters E: and R: via Disk Management or Diskpart.exe : Select drive 0 -> select part 1 -> assign the letter r: . To check the active recovery partition, execute the command:

Os/cells all

See the following paragraphs:

  1. Windows Boot Manager (points to the partition where the BCD boot loader is located). In my case, the bootloader is on the EFI partition: Windows Boot Manager ——- identify {bootmgr} device partition=DeviceHarddiskVolume2 path EFIMicrosoftBootbootmgfw.efi description windows and-US Boot Manager local inherits {globalsettings} default {current} resumption object {dbaf5561-4424-1-b766-b7001b047795} display order {current} toolsdisplayorder {memdiag} timeout 30protest Windows Boot Manager configuration check
  2. Now look at the values in the Windows Bootloader section. The Winre.wim image file (recovery environment) is located on the second partition called Volume Windows RE.Windows Boot Loader ——- identifier {dbaf5563-4424-1-b766-b7001b047795} device ramdisk=[E:]RecoveryWindowsREWinre.wim,{dbaf5564-4424-1-b766-b7001b047795} path windowssystem32winload.efi description Windows RE locale en-us inherit {bootloadersettings} displaymessage Windows RE osdevice ramdisk=[E:]RecoveryWindowsREWinre.wim,{dbaf5564-4424-1-b766-b7001b047795} system windows nx OptIn bootmenupolicy default winpe yes

To increase the size of the main volume of Windows, we need to remove the Recovery partition on the right side, expand the volume and recreate the Recovery partition. Instead of recreating the recovery partition, in most cases, you can simply move the files from the recovery environment to the C: drive. You will then be completely freed from a separate 500 MB WinRE partition. The recovery environment file is then stored on the partition where Windows is installed.

Run these commands to copy the WinRE.wim file to the system volume and specify the new location of the WinRE.wim:

md c. Reagent C/Disablemd c: RecoveryWinRE
xcopy e: RecoveryWindowsREWinre.wim c: RecoveryWinRE /h
reagentc /setreimage /path c: RecoveryWinRE /target C: Windows
reagentc /enable

If you attempt to remove a recovery partition from the Disk Management GUI by clicking the Remove Volume button (sometimes the disk properties are not available at all), you will receive the following error message:

Remove Virtual Disk Manager

It is not possible to delete a secure partition without a set of forced security settings.

The only way to remove such a secure partition is to use the diskpart program. Open a command prompt and execute the diskpart command. Select the partition you want to delete (note the results of the commands as the number of disks and partitions may vary).

DISKPART> rescan
DISKPART> list of hard drives
DISKPART> select hard drive 0
DISKPART> list of components
DISKPART> select part 5
DISKPART> delete partition overwrite

DiskPart has successfully deleted the selected partition.

DISCUSSION

The override parameter allows the disk element to delete any partition, regardless of its type (active, system or bootable).

 

You can now open Disk Manager and expand the system partition (the Increase volume option is now available). If you need to recreate the recovery partition (it is recommended that you back it up or move it to the system partition as described above), leave 500 MB of unallocated disk space. In the screenshot below I increase the Windows partition by 1.5 GB and leave 500 MB at the end of the disk.

 

After enlarging the main partition I still had 500 MB of free space left for the WinRE recovery partition.

 

Windows recognizes the partition to be restored by special markers : The GUID is the94bba4-06d1-4d40-a16a-bfd50179d6ac and the GPT attribute is 00000000001.

Let’s create a new partition and give these attributes:

DISKPART> create primary
DISKPART> format quick fs=ntfs label=WinRE
DISKPART> assign letter=R
DISKPART> id=de94bba4-06d1-4d40-a16a-bfd50179d6ac setup

DiskPart has successfully set the partition ID

DISKPART> gpt attributes= 00000000001

DiskPart has successfully assigned attributes to the selected GPT partition.

Exit

 

Then copy the WinRE files from the Windows 10 installation disk (image) to a new recovery partition.

Mount the install.wim file from your Windows 10 installation ISO image and extract the WinRE file (Winre.wim):

md C: WinISO
md C: WinISOmount
dem /mount-wim /wimfile:F: install sources.wim /index: 1 /mountdir: C: WinISOmount /readonly
md R: RecoveryWinRE
copy C: WinISOmountWindowsSystem32RecoveryWinre.wim R: RecoveryWinRE
dism /unmount-wim /mountdir: C: WinISOmount /discard

Then simply move the WinRE file to the recovery partition and update the configuration of the bootloader:

reagentc /setreimage /path R:RecoveryWinRE /target C:Windows
reagentc /enable

 

So we recreated the recovery partition and saved a new path to the WinRE image. If you have problems starting up Windows, your recovery environment will start automatically.

How to remove the recovery partition and move the BCD in the BIOS to the PC?

If your computer is BIOS-based (not UEFI-based), you can move the Windows Boot Manager (BCD) and Recovery Environment files to Volume C: before deleting the Recovery partition, as follows

First you have to move the BCD files from station E: to station C : (I have assigned this drive letter to the recovery partition):

Reg lost robocopy HKLMBCD0000
e: c: bootmgr
roboocopy e:boot c:boot /s
bcdedit /store c:bootbcd /set {bootmgr} device partition=C:
bcdedit /store c:bootbcd /set {memdiag} device partition=C

If you have problems with the BCD, you can restore the BCD file and the Master Boot Record (MBR) as described in this manual.

Then move the image from the recovery angle:

md c. Reagent C/Disablemd c: RecoveryWinRE
xcopy e: RecoveryWindowsREWinre.wim c: RecoveryWinRE /h
reagentc /setreimage /path c: RecoveryWinRE /target C: Windows
reagentc /enable

You can now remove the Recovery partition with DiskPart (as described above) and successfully expand the system partition.

Related Tags:

gparted move windows recovery partition,easeus move recovery partition,recreate recovery partition windows 10,rearrange partition order,how to extend recovery partition windows 7,set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac",how to shrink recovery partition windows 10,extend non contiguous partition,windows server 2016 create recovery partition,windows 10 move recovery partition gparted,windows server 2019 delete recovery partition,windows 10 recreate recovery partition,msi winretools partition,how to extend partition minitool,partition extender tool,move partition windows 10 diskpart,windows 10 create new recovery partition,macrium reflect move partition,windows move partition to end of disk,winre partition,repair recovery partition windows 10,windows 10 recovery partition size,windows 10 recovery partition delete,recovery partition hp,windows 10 create recovery partition,windows 10 multiple recovery partitions,extend system drive but recovery partition is in the way,windows 10 delete recovery partition,windows 10 recovery partition