How to Move Windows Recovery Partition

Required to move Windows Recovery Partition as the need on extending the ROOT drive.

Because the Windows Server 2022 VM was originally 100GB.


How-to
Checked the WinRE status
C:\Windows\system32> reagentc /info


To disable the WinRE
C:\Windows\system32> reagentc /disable
REAGENTC.EXE: Operation Successful.


DiskPart
C:\Windows\system32> diskpart

DISKPART> list disk

DISKPART> select disk 0

DISKPART> list partition


Selected the WinRE partition, e.g. partition 4
DISKPART> select partition 4

DISKPART> delete partition override


Selected the ROOT partition to extend
DISKPART> select partition 2

DISKPART> extend size=102400
  • The space, in megabytes (MB), to add to the current partition. If you don't specify a size, the disk is extended to use all the next contiguous unallocated space.

Created back the WinRE partition
DISKPART> create partition primary size=1024

DISKPART> set id=27

DISKPART> format quick fs=ntfs
  • set id = 27 as MBR

If GUID
DISKPART> set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac

DISKPART> gpt attributes=0x8000000000000001


DISKPART> exit


When enabling the Windows Recovery Partition, got an error, however.
C:\Windows\system32> reagentc /enable
REAGENTC.EXE: The Windows RE image was not found. 


Went to review, not find.
C:\Windows\system32> dir /A "C:\Windows\System32\Recovery"


Solved it by:
C:\Windows\system32> dism /Mount-Image /ImageFile:D:\sources\install.wim /Index:1 /MountDir:C:\mount /ReadOnly

C:\Windows\system32> xcopy C:\mount\Windows\System32\Recovery\winre.wim C:\_tmp /h

C:\Windows\system32> dism /Unmount-Image /MountDir:C:\mount /Discard

C:\Windows\system32> xcopy C:\_tmp\Winre.wim C:\Windows\System32\Recovery /h

C:\Windows\system32> reagentc /enable
  • Required to mount Windows Server ISO



References