135

I upgraded to Windows 10 and a 450Mb Recovery partition was created on my disk. I would like to extend the system partition but the Recovery partition is in the way.

How can I move the Recovery partition to the end of the disk volume without installing third party software?

mael'
  • 1,946
pharsfalvi
  • 1,451

5 Answers5

143

According to MS's documentation, capture-and-apply-windows-system-and-recovery-partitions, the recovery partition can be captured and applied to a new partition. I have made it to work on my windows 10 PC.

Warning 1: You must know what the following commands do before you execute them. Check the link above and MS's documentation for diskpart, dism and reagentc.

Warning 2: Check disk numbers, partition numbers and volume letters carefully before executing commands.

  1. Use diskpart to find current recovery partition and assign a driver letter(eg. O) to it:
DISKPART> list disk
DISKPART> select disk <the-number-of-disk-where-current-recovery-partition-locate>
DISKPART> list partition
DISKPART> select partition <the-number-of-current-recovery-partition>
DISKPART> assign letter=O
  1. Create an image file from current recovery partition:
Dism /Capture-Image /ImageFile:C:\recovery-partition.wim /CaptureDir:O:\ /Name:"Recovery"
  1. Apply the created image file to another partition(eg. N) that will become the new recovery partition:
Dism /Apply-Image /ImageFile:C:\recovery-partition.wim /Index:1 /ApplyDir:N:\
  1. Register the location of the recovery tools:
reagentc /disable
reagentc /setreimage /path N:\Recovery\WindowsRE
reagentc /enable
  1. Use diskpart to hide the recovery partition:
    • For UEFI:
    DISKPART> select volume N
    DISKPART> set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    DISKPART> gpt attributes=0x8000000000000001
    DISKPART> remove
    
    • For BIOS:
    DISKPART> select volume N
    DISKPART> set id=27
    DISKPART> remove
    
  2. Reboot the computer, now the new recovery partition should be working
  3. (Optional) Delete the old recovery partition:
DISKPART> select volume O
DISKPART> delete partition override
  1. (Optional) Check if the recovery partition is working:
    1. Show the current status:
      reagentc /info
      
    2. Specifies that Windows RE starts automatically the next time the system starts:
      reagentc /boottore
      
    3. Reboot the computer and do your stuff in Windows RE (eg. enter CMD and run some tools)
VainMan
  • 1,531
  • 1
  • 6
  • 7
58

I know VainMain's answer from above is probably more careful and thorough, but I've been able to successfully move the partion by simply doing:

  1. In Windows 10: reagentc /disable
  2. In Linux boot CD: Adjust neighboring partition as needed/move recovery partition.
  3. In Windows 10 reagentc /enable

Recovery environment was automatically rediscovered and booted WinRE just fine with all recovery options (Reset/System Image restore/etc). I had only 1 C: partition, no special partitioning/dual booting/multiple recovery partition/crazy BCDEDIT settings beforehand, which helped. Tested inside a VM beforehard to make sure. Had no problems after executing live.

If I remember correctly, skipping the first step (disabling via reangetc) would cause the recovery environment to end up misconfigured, not properly re-bootable, and not easily fixed.

Nick Bolton
  • 3,660
crimshauw
  • 581
8

An example how to move Recovery Partition to OS Partition

diskpart
DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 NTFS Partition 617 MB Healthy Hidden

DISKPART> select volume 2 DISKPART> assign letter=F DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> exit

xcopy F:\Recovery C:\Recovery /E /H /I
ReAgentc /info

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk2\partition3\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: b4c3cf2d-1282-11ed-b4c8-b90a37105c4b
    Recovery image location:
    Recovery image index:      0
    Custom image location:
    Custom image index:        0
ReAgentc /disable

ReAgentc /setreimage /path C:\Recovery\WindowsRE /target C:\Windows

ReAgentc /enable
ReAgentc /info

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk2\partition2\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: b4c3cf2f-1282-11ed-b4c8-b90a37105c4b
    Recovery image location:
    Recovery image index:      0
    Custom image location:
    Custom image index:        0

NOTE: Observe that "partition3" changed to "partition2"

delete a Recovery Partition

diskpart
DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> select volume 2 DISKPART> detail partition

Partition 3 Type : 27 Hidden: No Active: No Offset in Bytes: 83763396608

Volume ### Ltr Label Fs Type Size Status Info


  • Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> delete partition override DISKPART> exit

7

Like the person above I was able to do this by

  1. Open Windows Command prompt as admin and run reagentc /info
  • this showed recovery as Enabled, and gave the location on the disk and the BCD identifier.
  1. reagentc /disable
  • reagentc /info showed Disabled, no location and a zero identifier
  1. Shut down and boot into Linux. Move the recovery partition (to the left) with GParted.
  2. Shut down and boot back into Windows. Run reagentc /enable (reported Operation Successful)
  • reagentc /info now showed Enabled, the same location and a new BCD identifier (one digit different).
Fieldmouse
  • 79
  • 1
  • 3
4

Just as an addition to the answer of VainMan and the comment of haridsv (can't comment myself yet):

I had the same problem. Instead of DISKPART> remove execute mountvol N: /d on the command line. If you already have removed the partition first reassign a drive letter to the new recovery partition with assign letter=N (normally reagentc /info should now show the correct status again, otherwise repeat step 4 of VainMans instructions).

Stumdra
  • 41
  • 3