Re-sizing Disk and Recreating Recovery Partition
Re-sizing Disk and Recreating Recovery Partition

Re-sizing Disk and Recreating Recovery Partition

There are occasions that we want to expand existing disk space like in situation where we cloned a disk from a smaller hard drive to a bigger one or removing drive D as data drive so that we don’t run out of disk space on C that crashes our system.

There is also, expanding of VM image’s allocated space. (Although removal of recovery drive don’t impact the operation of VM, keeping the recovery partition may be useful for moving virtual to physical for troubleshooting issues in recovery console).

Usually such situation, involves backing up existing data, removing secondary partition and extending the primary partition to utilize the freed up space from the removed partition. But with recovery partition at the end of the original disk, the extension of space would require deleting the recovery partition, extending the disk and leaving no option to go into recovery mode for troubleshooting.

The following steps are for expanding a virtual machine disk size but is also applicable for physical machine using the same commands to achieve expanding a partition and keeping recovery partition without using third party software.

Running diskpart on virtual shows 19GB space on main windows partition on 3 with 530MB recovery on partition 4.


Disk was expanded via Hyper-V Manager by editing the vm disk and expanding it.


We accessed the Windows 10 vm via RDP or console and deleted the recovery partition 4 using diskpart.

  1. Run CMD as administrator
  2. Type diskpart
  3. Within diskpart > prompt, type select disk 0
  4. list partition (show all partition in disk 0)
  5. Type select partition 4 (select for removal)
  6. Type delete partition 4 override (force deletion)
  7. Type exit twice from diskpart and cmd prompt box.

Once done. Start Windows Disk Manager (diskmgr.exe) and expand the disk with space available.

Start disk manager to extend the disk after removing the recovery partition.
Extend volume from disk manager


Reserve 700MB at the end of disk from total available space to allocate for recovery partition to be added later.


Create recovery partition by following the following steps: (bold being commands to type)
Run diskpart as administrator
select disk 0
create partition primary
format quick fs=ntfs label=”WinRE”
set id=”de94bba4-06d1-4d40-a16a-bfd50179d6ac”
assign letter=R
Exit from diskpart typing exit and exit again to close command prompt. Recovery is temporarily R and will be hidden upon reboot.

Download and insert Windows 10 iso and locate the wim file for your Windows version by listing sources\install.esd file with DISM.

List full list of version available in install.esd and take note of the index number by running
DISM /Get-WimInfo /WimFile:D:\sources\install.esd
The version we are looking for is usually Windows 10 Pro which is index 6.

Create a temp folder and a mount folder in C drive.
1. Go to CMD, type md c:\temp && md c:\WinMount

Extract install.wim with command:
DISM /Export-Image /SourceImageFile:D:\sources\install.esd /SourceIndex:6 /DestinationImageFile:C:\temp\install.wim /Compress:Max /CheckIntegrity
There will be a install.wim file in C:\temp which will need to be mounted.
Verify index on install.wim with
DISM /get-wiminfo /wimfile:c:\temp\install.wim
Then mount install.wim to C:\WinMount with
DISM /mount-wim /wimfile:c:\temp\install.wim /index:1 /mountdir:c:\WinMount /readonly
Win10 recovery partition stores Winre.wim in Recovery\WindowsRE.
Xcopy the files in WinMount folder C:\WinMount\Windows\System32\Recovery to R:\Recovery\WindowsRE (R was assigned earlier in diskpart) with
xcopy C:\WinMount\Windows\System32\Recovery\*.* R:\Recovery\WindowsRE\*.* /h
Then point the recovery point to it using
reagentc /setreimage /path R:\Recovery\WindowsRE /target C:\Windows
and enable it with
reagentc /enable

Delete temp folder and Cleanup mounted path by closing file explorer and running
DISM /Unmount-Image /MountDir:C:\WimMount /Discard

Delete also the WimMount folder to clean up.