Computer >> Computer tutorials >  >> System >> Windows Server

Extend Volume Blocked by a Recovery Partition on Windows 10

Once I saw that one of the test virtual machines was running out of free space on system drive C:. I increased the disk size in the virtual machine settings and switched to the guest OS (Windows 10) to extend the size of the system partition using the unallocated space. When I opened the Disk Management console (diskmgmt.msc), I noticed that there were two recovery partitions on the drive. And the unallocated space was appeared after the second recovery partition (labeled as Windows RE). On some reason the recovery partition is located after the main partition (C:) and does not allow to expand the primary volume by using the unallocated space.

In this article we will consider two different ways to delete and recreate the recovery partition for EFI and BIOS computers. So, prior to proceeding the steps described below, find out what architecture is used on your computer. Also it is strongly recommended to backup (or make a snapshot ) your critical data before trying to make changes to the partition table.

How to Move Recovery and Extend System Partition on UEFI-based Computer?

On my virtual machine, Windows 10 is installed in UEFI mode (Partition style: GPT).

Extend Volume Blocked by a Recovery Partition on Windows 10

As you can see on the screenshot below, the “Extend Volume” button is inactive (gray). You can extend the partition using the Windows built-in tools if it has an unallocated space to the right of it (Windows 10 cannot extend primary partition to the right into unallocated space). In my case, I cannot extend the C: drive because it is blocked by the recovery partition (Windows RE). So, prior to extending the size of the system partition, I will have to delete the recovery partition.

Extend Volume Blocked by a Recovery Partition on Windows 10

On the screenshot, you can see that there are two recovery partitions (Recovery and Windows RE). To understand, which of them is used by Windows as an active recovery partition, you must assign the drive letters to your partitions. For example, you can assign a drive letters E: and R: using the the Disk Management or Diskpart.exe: select disk 0 -> select part 1 -> assign letter r: . To check the active recovery partition, run the command:

bcdedit /enum all

Please pay attention to the following sections:

  1. Windows Boot Manager (it indicates the partition where the BCD bootloader is located). In my case, the bootloader is on the EFI partition:
    Windows Boot Manager
    --------------------
    identifier {bootmgr}
    device partition=\Device\HarddiskVolume2
    path \EFI\Microsoft\Boot\bootmgfw.efi
    description Windows Boot Manager
    locale en-US
    inherit {globalsettings}
    default {current}
    resumeobject {dbaf5561-4424-11e9-b766-b7001b047795}
    displayorder {current}
    toolsdisplayorder {memdiag}
    timeout 30

    Extend Volume Blocked by a Recovery Partition on Windows 10

  2. Now look at the values in the Windows Boot Loader section. The Winre.wim image file (recovery environment) is located on the second partition with the Windows RE volume label.
    Windows Boot Loader
    -------------------
    identifier {dbaf5563-4424-11e9-b766-b7001b047795}
    device ramdisk=[E:]\Recovery\WindowsRE\Winre.wim,{dbaf5564-4424-11e9-b766-b7001b047795}
    path \windows\system32\winload.efi
    description Windows RE
    locale en-us
    inherit {bootloadersettings}
    displaymessage Windows RE
    osdevice ramdisk=[E:]\Recovery\WindowsRE\Winre.wim,{dbaf5564-4424-11e9-b766-b7001b047795}
    systemroot \windows
    nx OptIn
    bootmenupolicy Standard
    winpe Yes

To expand the size of the main Windows volume, we will have to delete the recovery partition to the right of it, extend the volume and recreate the recovery partition.

Instead of re-creating the recovery partition, in most cases it will be enough to move the recovery environment files to the drive C:. Then you will be able to completely refuse from using a separate 500MB WinRE partition. The recovery environment file will then be stored on the partition where Windows is installed.

To copy the Winre.wim file to the system volume and set new the WinRE.wim file location, run these commands:

reagentc /disable
md c:\Recovery\WinRE
xcopy e:\Recovery\WindowsRE\Winre.wim c:\Recovery\WinRE /h
reagentc /setreimage /path c:\Recovery\WinRE /target C:\Windows
reagentc /enable

If you try to delete the recovery partition from the Disk Management GUI  by clicking Delete Volume (sometimes the disk properties are not available at all), the following error will appear:

Extend Volume Blocked by a Recovery Partition on Windows 10

Virtual Disk Manager

Cannot delete a protected partition without the force protected parameter set.

Extend Volume Blocked by a Recovery Partition on Windows 10

You can delete such a protected partition only using the diskpart tool. Open the elevated command prompt and run the diskpart command. Select the partition you want to delete (note the results of your commands, since the numbers of disks and partitions may vary).

DISKPART> rescan
DISKPART> list disk
DISKPART> select disk 0
DISKPART> list part
DISKPART> select part 5
DISKPART> delete partition override

DiskPart successfully deleted the selected partition.

DISKPART> Rescan

The override parameter allows diskpart to delete any partition regardless of its type (whether it is an active, system, or boot partition).

Extend Volume Blocked by a Recovery Partition on Windows 10

Now you can open the Disk Management and extend the system partition (the Extend Volume option is now available). If you want to recreate the recovery partition (it is recommended to save it or move it to the system partition as described above), leave 500MB of unallocated space on your drive. In the screenshot below, I am extending my Windows partition by 1.5GB and leaving 500MB at the end of the drive.

If there are any other vendor recovery partitions on the disk that prevent you from extending the main volume, check the article “How to Delete an OEM Partition?”.

Extend Volume Blocked by a Recovery Partition on Windows 10

After extending the main partition, I have 500MB free space left for WinRE recovery partition.

Extend Volume Blocked by a Recovery Partition on Windows 10

Windows detects the recovery partition by the special labels: GUID — de94bba4-06d1-4d40-a16a-bfd50179d6ac and the GPT attribute 0x8000000000000001.

Let’s create a new partition and assign these attributes to it:

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

DiskPart successfully set the partition ID

DISKPART> gpt attributes=0x8000000000000001

DiskPart successfully assigned the attributes to the selected GPT partition.

Exit

Extend Volume Blocked by a Recovery Partition on Windows 10

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

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

md C:\WinISO
md C:\WinISO\mount
dism /mount-wim /wimfile:F:\sources\install.wim /index:1 /mountdir:C:\WinISO\mount /readonly
md R:\Recovery\WinRE
copy C:\WinISO\mount\Windows\System32\Recovery\Winre.wim R:\Recovery\WinRE\
dism /unmount-wim /mountdir:C:\WinISO\mount /discard

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

reagentc /disable
reagentc /setreimage /path R:\Recovery\WinRE /target C:\Windows
reagentc /enable

Here you can find the full article about WinRE environment in Windows.

Extend Volume Blocked by a Recovery Partition on Windows 10

So, we have recreated the recovery partition and registered a new path to the WinRE image. If you have any Windows boot problems, your recovery environment will boot automatically.

If you have any issues with your EFI bootloader or the EFI partition, follow the links to read the related articles.

How to Delete the Recovery Partition and Move the BCD on BIOS-based PC?

If your computer is based on BIOS (not UEFI), you can move the Windows boot manager (BCD) and the recovery environment files to the C: volume prior to deleting the recovery partition as follows.

First of all, you have to move BCD files from drive E: to drive C: (I have assigned this drive letter to my recovery partition):

Reg unload HKLM\BCD00000000
robocopy e:\ c:\ bootmgr
robocopy e:\boot c:\boot /s
bcdedit /store c:\boot\bcd /set {bootmgr} device partition=C:
bcdedit /store c:\boot\bcd /set {memdiag} device partition=C:

In case of any BCD problems, you can rebuild the BCD file and Master Boot Record (MBR) as described in this instruction.

Then move the recovery wim image:

reagentc /disable
md c:\Recovery\WinRE
xcopy e:\Recovery\WindowsRE\Winre.wim c:\Recovery\WinRE /h
reagentc /setreimage /path c:\Recovery\WinRE /target C:\Windows
reagentc /enable

Now you can remove the recovery partition using diskpart (as shown above) and extend your system partition successfully.