72

My partitions on my primary disk look like this:

enter image description here

I would like to expand C: with the Unallocated space but the 946 MB Recovery partition is in the way.

  1. Is there a way to swap the Recovery partition with the Unallocated space (= move it to the end of the disk), to have contiguous WINDOWS and Unallocated space?
  2. what would be the consequences of removing that 946 MB Recovery partition? There are numerous articles mentioning that it exists and how to remove it (with diskpart), but not what it actually stores and whether it is primordial to have it (as opposed to having a Windows 10 media disk one can boot from and go into repair mode)
Giacomo1968
  • 58,727
WoJ
  • 3,875

4 Answers4

31

You can't "swap" them but you can move the recovery partition easily. Any 3rd party partitioning software can do that, like MiniTool Partition Wizard, AOMEI Partition Assistant, EaseUS Partition Master, Macrorit Partition Expert...

So after installing any of them you need to

  • Right click on the recovery partition > resize/move and move it all the way to the right
  • Right click on the Windows partition > resize/move and resize it to fill the newly unallocated space on the right of it

Or you can remove the recovery partition completely. There would be no problem since Windows 10 already has built-in refresh and reset feature to do factory reset. You can also create an image of the recovery partition and store it somewhere before removing the partition

However it is possible to create a partition that spans across various spaces with dynamic disk, which is the analog of Linux's LVM. Just convert the disk to dynamic and extend the partition to any available space

phuclv
  • 30,396
  • 15
  • 136
  • 260
30

You don't need to even reboot for this :-)

Once you disabled the recovery partition, you can just launch diskpart and complete the changes.

you'll be able to

  1. delete the recovery parttion
  2. extend your C: partition to a desired size
  3. recreate the recovery partition with the correct type
  4. format the recovery partition

1. identify and delete recovery partition

so, first you need to disable it, that's the already known command:

reagentc /disable

with that done, launch diskpart

where you pick your OS drive by ID and the recovery partition by ID. And then you delete it. This is possible using the override keyword asking Windows to not consider that protected partition a protected protected partition for that short moment where you delete it.

list disk  #< identify OS drive here, example below is 'disk 0'
sel disk 0
list part  #< identify recovery partitition here, example below is 'part 3'
sel part 3
delete part override

2. resize your C: partition

where you select your OS partition by ID and increase its size - while leaving space for the recovery partition's recreation. The partition resize automatically triggers the filesystem resize.

list part #< OS partition, C:\ Drive letter is part 2 in example below
sel part 2
extend size=112000

3. create recovery partition

where you re-create the recovery partition for later use. if you (reader, not OP) has a UEFI system this command will DIFFER. See Microsoft KB5028997 for details about that.

3.1 Basic Disks

create partition primary size=1000 id=27

3.2 GPT Disks

On GPT disks, you'll get an error about incorrect syntax for this. There use:

create partition primary size=1000 id=de94bba4-06d1-4d40-a16a-bfd50179d6ac

If this worked, the new partition is auto-selected and can be formatted. If it didn't work, then please stop here and debug.

format quick fs=ntfs label="Windows RE tools"
exit

Note:

  1. You can then use the partition ID from @AdamKalisz's comment below!
  2. The newly created partition is automatically selected by diskpart.
  3. You want a size of 1GB for the partition to avoid errors from windows Upgrade (that's the 0x80070643 error code). It can hit the error condition when updating the recovery code (done via windows update).

4. enable recovery partition

now you can re-enable the new recovery partition

reagentc /enable

That's it. I had to do this a few days ago, and there's really no need to have a downtime for this. You might still need to reboot for the update, but at least it'll be at a time of your chosing.

If the update error doesn't go away, you might want to investigate windows update client issues.

5. When your system never had a valid RE image

There's also an edge case if there's no valid copy of the recovery image on disk - there still can be a partition, but it might be invalid. I've also seen cases with 3 rescue partitions.

5.1 Mounting a WIM image and extracting the WinRE boot image

In such cases, you can proceed - but: you might need to re-genererate the RE image. This works along the lines what is described here: https://www.elevenforum.com/t/deleted-windows-recovery-partition-how-to-make-a-new-one.11534/

5.2 Working with readonly (DVD) media

Just note that you might need to change some flags for dism to work with a readonly image. i.e. I needed dism /mount-wim [...] /readonly and dism /unmount-wim [...] /discard when working from a dvd image, and then you also need to re-locate the RE path to your actual partition. just check it with /info to be sure it's in the right spot.

5.3 Don't lose the security patch!

Since MS updated the RE image in early 2024, you should also make sure that if you use a DVD source that you'll use one that is recent enough to contain a 'safe' winre.wim (*).

(*Footnote: Yes, I know that is tricky or might be nigh impossible on editions like LTSC. I suppose maybe one can then reinstall the januar 24 patch, but I don't know. I made a life choice to not do windows support decades ago and this is info as far as i'll bend that rule)

8

Moving the Windows Recovery partition to the end of the disk is (ironically) much easier with Linux. So if you already can boot a live Linux CD (or USB or over PXE), it probably has gparted which you can use to move the partition.

So :

  • In Windows, disable the current recovery partition. As admin in Powershell or cmd, run :
    reagentc /disable
  • In Linux, use gparted to
    • move the recovery partition to the end of the disk
    • resize the system partition
  • Back in Windows, re-enable the recovery partition:
    reagentc /enable
mivk
  • 4,015
1

HirensBootCd combined with Rufus, Will help you create a boot USB that will give you the tools to do this.

I'd recommend backing up your primary partition before you start.

MacroIT Partition Tool, included on HirensBootCD can easily move the recovery partition to the end of the drive, HOWEVER resizing the primary should be done using windows disk management, as MacroIT Partition Tool leaves the filesystem as RAW (after resize operations).

I recently made this mistake, and whilst it was RAW windows allowed it to boot ONCE into the drive, letting me think that it had worked, then trying it once more made windows 10 fail in it's bluescreen with an NTFS Filesystem failure. (Luckily I took a backup)

If I had used windows disk management to do the resize, I believe it would have maintained the file system integrity.