Moving Windows Recovery Partition Correctly

Moving Windows Recovery Partition Correctly
Moving Windows Recovery Partition Correctly

Recently I needed to expand a disk on a Windows 10 VM and a Windows Server 2022 VM, but I couldn’t because the Recovery Partition was in the way.

When searching for a way to do this I discovered that the internet is full of posts about simply deleting the Windows Recovery Partition. I am not a fan of simply deleting a recovery tool. On numerous occasions the recovery partition has been instrumental in helping me to fix a system.

If you search for how to move the Windows Recovery Partition the internet has many posts of fake ways to do it or ways to do it with third-party tools like GParted. I have nothing against third-party tools or GParted and I don’t doubt some of those methods do work. The issue I have with those methods is that you have to take the system offline in order to do them or the tools cost money.

Now yes you could just delete the Windows Recovery partition, but before you do that make sure you understand that you will lose a bunch of recovery options. You can read more about the recovery options you’ll lose in an earlier post I made about the Windows Recovery Partition.

Here’s how to correctly move the Windows Recovery Partition on a Windows server or a normal Windows system.

The Process

  • Make sure you have a backup of the system you are going to edit the partitions on.
  • Open Command Prompt as admin
Run CMD as admin

Disabling The Windows Recovery Partition

  • We need to disable the existing Windows Recovery Partition to do that run the command 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)

The Windows Recovery Partition File

DiskPart

  • Run the command diskpart to launch DiskPart
Launching DiskPart
  • List the disks in your system. You can do this by using the command list disk
Listing the disks in DiskPart
  • Select the disk you need to move the recovery partition on. You can do this by using the command select disk and the disk number. In my setup disk 0 was the correct disk and the command I entered was select disk 0.
Selecting the disk in DiskPart
  • List the partitions on that disk. You can do this by using the command list partition
Listing the partitions in DiskPart
  • Select the recovery partition. You can do this by using the command select partition and the partition number. In my setup partition 4 is my recovery partition and the command I entered was 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.

  • Force the deletion of the recovery partition. You can do this by using the command delete partition override
Forcing the partition deletion

Disk Management

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
  • Expand your disk and leave about 1024 MB off your resized size to leave room for the re-enabling the Recovery Partition.
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.

  • Create a New Simple Volume with the unallocated space.
Creating a New Simple Volume
  • You can give the new partition a name if you want it does not mater. I’m going to call mine New Recovery.
Naming the New Simple Volume
  • Don’t give it a drive letter.
Not giving the New Simple Volume a drive letter or a drive path

Disk Management should now look something like this.

Disk Management with the newly created partition that will become the Windows Recovery Partition

Back to DiskPart

  • In DiskPart list your partitions again by running the command list partition
Listing the partitions with DiskPart
  • Select the 1024 MB partition with the command select partition and the partition number. In my setup it was partition 4 and the command I ran was select partition 4
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.

GPT disk

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

  • Run the following command to set the partition as 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

  • Run the following command to set the GPT attribute to hide the drive and flag it as required gpt attributes=0x8000000000000001
Setting the GPT attribute in DiskPart
  • Now we can exist DiskPart.
Exiting DiskPart

MBR disk

On MBR disks we need to change partition ID to 27 which will tell Windows that this is a recovery partition.

  • Run the following command to set the partition as a recovery partition set id=27
setting the MBR partition ID in DiskPart
  • Now we can exist DiskPart.
Exiting DiskPart

Enabling The Windows Recovery Partition

  • Now we can re-enable the recovery partition by running the command 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.

If you want to read more about deploying the Windows Recovery Partition you can do so by reading Microsoft’s documentation about it.

If you want to read more about reagentc command you do so by reading Microsoft’s documentation about it.

12 responses to “Moving Windows Recovery Partition Correctly

Dzery

Thank you, I tried your solution and it worked very well. I like it because it does not need third party software and preserves recovery partition. Your description is very clear and detailed.

Daniel Keer

That’s awesome! I’m glad it worked out.

Serhat

Thank you very much. I did it without need any third party soft.

Daniel Keer

No Problem!

Rick

Just what I needed for my Windows 10 VM.
The instructions are thoroughly explained and the accompanying visuals are quite useful.
Most importantly, it worked without any problems.

Daniel Keer

Awesome!

Matt

Agreed with Dzery – fantastic post, very easy to follow, doesn’t require third party software or rebooting, made upgrading my wife’s laptop very easy. I’d been struggling with thinking that Disk Management could move the partition, and had moved on to using gparted but wasn’t sure how to make that work. This was really easy and I think it took longer to read through it than to do it. Thanks, much appreciated!

I didn’t know if the PC’s setup was GPT or MBR. I Googled it, and it’s actually in your screenshot under the “list disk” command – in the “GPT” column, an asterisk indicates that the disk is setup as GPT; if that asterisk is not there, then it’s MBR.

Daniel Keer

oh Nice! I think it’s a lot more common to see GPT disks than MBR now. I almost didn’t add the MBR part.

pouya

Thank you so much, your solution worked. It was easy and clear.

Daniel Keer

Yay!

brent

Worked well for me on Windows Server VM and my disk was also MBR

Daniel Keer

Yay!!

Leave a comment

Your email address will not be published. Required fields are marked *