How to expand the Windows partition when the Recovery one is in the way?

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)

thanks to Florian Heigl

https://superuser.com/questions/1354574/how-to-expand-the-windows-partition-when-the-recovery-one-is-in-the-way

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *