https://thedxt.ca/2023/06/moving-windows-recovery-partition-correctly/
Run CMD as admin
reagentc /disable
Disabling the Recovery Partition
The reagentc /disable command will disable the recovery partition and will move the recovery partition into a file named Winre.wim and will be located in C:\Windows\System32\Recovery (you have to enable showing hidden system files if you want to see it)
Winre.wim
C:\Windows\System32\Recovery
The Windows Recovery Partition File
diskpart
Launching DiskPart
list disk
Listing the disks in DiskPart and showing the disk is a GPT disk
Pro tip from Matt in the comments, if there’s a * in the column for Gpt that means the disk is likely a GPT disk and if there isn’t a * in the Gpt column the disk is likely MBR. Make a note of this as it will be important further down.
select disk
select disk 0
Selecting the disk in DiskPart
list partition
Listing the partitions in DiskPart
select partition
select partition 4
Selecting the partition in DiskPart
The recovery partition is a protected partition so we need to use a bit more force to delete it.
delete partition override
Forcing the partition deletion
Now if you look in Disk Management you should no longer have the Recovery Partition and it should show up as unallocated.
Disk Management with the Recovery Partition deleted
Expanding the partition but leaving room for the Windows Recovery Partition
Disk Management should now look something like this.
Disk Management after expanding the disk and leaving room for the Windows Recovery Partition
Once the disk is expanded we need to rebuild everything that is needed for Windows to know that the extra space that we left unallocated can be used to for the recovery partition.
Creating a New Simple Volume
Not giving the New Simple Volume a drive letter or a drive path
Naming the New Simple Volume
Disk Management with the newly created partition that will become the Windows Recovery Partition
Listing the partitions with DiskPart
Selecting the partition with DiskPart
If you have a GPT disk you need to run some very specific command and if you have an MBR disk you need to run different very specific commands.
On GPT disks we need to change the partition ID to de94bba4-06d1-4d40-a16a-bfd50179d6ac which tells Windows that this is a recovery partition
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
Setting the GPT partition ID in DiskPart
We also need to hide the drive and flag it as a required partition to do that we have to set a GPT attribute to 0x8000000000000001
gpt attributes=0x8000000000000001
Setting the GPT attribute in DiskPart
Exiting DiskPart
On MBR disks we need to change partition ID to 27 which will tell Windows that this is a recovery partition.
set id=27
setting the MBR partition ID in DiskPart
reagentc /enable
Enabling the Windows Recovery Partition
The reagentc /enable command will copy the Winre.wim file from C:\Windows\System32\Recovery into our new recovery partition.
Windows Recovery Partition file is now back on the recovery partition
If you look at Disk Management again everything shows up correctly.
That’s all there is to it.
Technically speaking we did just delete the Windows Recovery Partition but we did so in a way to keep our existing recovery partition safely intact and then we rebuild the recovery partition and re-enabled it.
I prefer doing it this way as it leaves your recovery options intact and you can do it all live without any reboots.