117

I upgraded to Windows 10 and a 450Mb Recovery partition was created on my disk. I would like to extend the system partition but the Recovery partition is in the way.

How can I move the Recovery partition to the end of the disk volume without installing third party software?

mael'
  • 1,946
pharsfalvi
  • 1,271
  • 3
    You can't do it using Windows 10 tools only. Not from Disk Management, neither using DISKPART. I personally recomend MiniTool Partition Wizard. Always backup your files before doing these kinds of operations. – ComputerUser121212 Jun 27 '19 at 21:27
  • 2
    Thanks for the recommendation @milo8505. I have Windows 10 Pro version and for that I expected to handle such trivial tasks natively, now I see this is again something not to look for in the MS world... :/ – pharsfalvi Jun 28 '19 at 00:58
  • It's not a trivial task. Windows relies on this partition for specific functions. It's not very large either, so there's no great benefit to moving it for the majority of people. – music2myear Jun 28 '19 at 18:45
  • 1
    For future reference, you may be able to move the recovery partition (Windows RE) by deleting the partition manually and following the Windows RE deploy instructions on MSDN: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/deploy-windows-re – citelao Jun 05 '20 at 20:10
  • 1
    Warning: Minitool will install the Avast malware. You may be able to remove it, if you download avastcleaner and do it from safe mode. – unhammer Oct 07 '20 at 09:53
  • @music2myear If the disk is resized, the recovery partition interferes with contiguity. – R.J. Dunnill Oct 07 '21 at 15:36
  • I combined @crimshauw's and @ComputerUser121212's answer: reagentc /disable, then install and move partition with the free edition of MiniTool, then reagentc /enable. As far as i can tell MiniTool did not install Avast. – psmith Nov 04 '23 at 03:12

5 Answers5

124

According to MS's documentation, capture-and-apply-windows-system-and-recovery-partitions, the recovery partition can be captured and applied to a new partition. I have made it to work on my windows 10 PC.

Warning 1: You must know what the following commands do before you execute them. Check the link above and MS's documentation for diskpart, dism and reagentc.

Warning 2: Check disk numbers, partition numbers and volume letters carefully before executing commands.

  1. Use diskpart to find current recovery partition and assign a driver letter(eg. O) to it:
DISKPART> list disk
DISKPART> select disk <the-number-of-disk-where-current-recovery-partition-locate>
DISKPART> list partition
DISKPART> select partition <the-number-of-current-recovery-partition>
DISKPART> assign letter=O
  1. Create an image file from current recovery partition:
Dism /Capture-Image /ImageFile:C:\recovery-partition.wim /CaptureDir:O:\ /Name:"Recovery"
  1. Apply the created image file to another partition(eg. N) that will become the new recovery partition:
Dism /Apply-Image /ImageFile:C:\recovery-partition.wim /Index:1 /ApplyDir:N:\
  1. Register the location of the recovery tools:
reagentc /disable
reagentc /setreimage /path N:\Recovery\WindowsRE
reagentc /enable
  1. Use diskpart to hide the recovery partition:
    • For UEFI:
    DISKPART> select volume N
    DISKPART> set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
    DISKPART> gpt attributes=0x8000000000000001
    DISKPART> remove
    
    • For BIOS:
    DISKPART> select volume N
    DISKPART> set id=27
    DISKPART> remove
    
  2. Reboot the computer, now the new recovery partition should be working
  3. (Optional) Delete the old recovery partition:
DISKPART> select volume O
DISKPART> delete partition override
  1. (Optional) Check if the recovery partition is working:
    1. Show the current status:
      reagentc /info
      
    2. Specifies that Windows RE starts automatically the next time the system starts:
      reagentc /boottore
      
    3. Reboot the computer and do your stuff in Windows RE (eg. enter CMD and run some tools)
VainMan
  • 1,341
  • 1
    While creating the image, dism forced me to give a name with /name option, but other than that I was able to get through step 4. I confirmed that reagentc /info showed the status as Enabled, but once I changed the id to 27, status became Disabled and reagentc /boottore complained about the same. What could I be doing wrong? – haridsv Dec 31 '20 at 11:38
  • @haridsv Sorry to see now. You can run reagentc /enable to enable it again. – VainMan Jan 12 '21 at 17:40
  • I think I tried that and it gave an error, but I can't recollect it now. I will try again and get back to you with the correct message. – haridsv Jan 12 '21 at 17:50
  • 5
    There is a subtle gotcha, at least in Windows 10 2004, which is the one I just did this on: When reagentc /setreimage /path N:\Recovery\WindowsRE is executed, it actually doesn't change the Windows RE location. Once the original partition (O:) is deleted, reagentc reports Disabled. The workaround is to run reagentc /disable before step 4, or to do step 7 before step 4. – Jake F Jan 16 '21 at 15:01
  • 4
    @JakeF Thanks for nice finding this. Added a disable-step before step 4. – VainMan Jan 16 '21 at 17:57
  • 3
    I wanted to say great comment, people generally don't care about following through like this, and it bugs me But +1 and thanks are discouraged lol So I thought I might add a suggestion In step 2 there is no name for the image, Windows 10 1904 will complain if there is no name Just great to see thoughtful people putting the effort in, document the world! – Steve Feb 14 '21 at 00:16
  • @Steve When I did this using empty name was OK. Edited it to use non-empty name, MS has no document about this yet though. – VainMan Feb 16 '21 at 03:47
  • 22
    Great instructions! One comment: after following the above instructions, my new recovery partition kept reappearing in Windows Explorer/ This PC as drive 'N' despite the diskpart > remove step. I discovered there was a registry key \DosDevices\N: under Computer\HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices that was making this come back. Deleting that key fixed this issue. YMMV; registry editing precautions apply. This is detailed here: https://answers.microsoft.com/en-us/windows/forum/all/recovery-partition-came-up-and-i-want-to-hide-it/cf725a84-22da-4a6d-a8e5-df41263d3c49 – SSilk Jul 25 '21 at 21:12
  • It doesn't seem to work. I get the error: "Windows RE cannot be enabled on a volume with BitLocker Drive Encryption enabled." – user2297550 Nov 07 '21 at 14:48
  • BTW you can also use cygwin's dd to copy and restore the rescue partition once it moved. – jef Dec 21 '21 at 09:57
  • 1
    Thanks so much! For me running 'reagentc /info' at the end showed my recovery partition disabled. When I rebooted, it was enabled. – Clay Lenhart Jan 03 '22 at 03:44
  • Not working. Before step 3 I created a simple NTFS partition with 1.5GB with label "N". I then did step 3 which reports success (but I see no change in partition "N"). Then "reagentc /setreimage /path N:\Recovery\WindowsRE" fails with "REAGENTC.EXE: The specified path was not found." – croraf Jan 15 '22 at 10:33
  • @VainMan Please don't add disclaimers, as they're not needed and only serve to generate anxiety in inexperienced users - instead, please ensure the answer's directions/steps are correct and link to Microsoft Docs man pages as needed. – JW0914 Apr 15 '22 at 12:20
  • @JakeF It's not a "gotcha", it's simply the incorrect sequence of commands was executed, as in order for WinRE's path to be changed, it must be disabled (it's analogous to trying to capture a WIM of C: while booted to Windows) – JW0914 Apr 15 '22 at 12:25
  • If you remove the assigned drive letter (N: in the above example) after you're done (e.g. because the partition didn't have one prior to the move) then it will show up as disabled when you check the status. Re-adding the drive letter solves that issue. – Geert Smelt Sep 19 '22 at 14:39
  • @GeertSmelt Sorry for late reply. You forgot to reboot(step #6) after removing the volume letter. That would keep it enabled. – VainMan Oct 17 '22 at 16:31
  • 1
    @user2297550 If you get that message just turn off bitlocker on the "new recovery partition" – Julian Nov 12 '22 at 12:10
  • Great answer! I used it to resize a disk image for a VM while keeping the recovery partition at the end. I'll call the old recovery partition O and new one N still. I use an MBR, not UEFI, setup, which it turns out imposes limitations on the number of Primary partitions which can be created by default. Since C is Primary, it's best if N is NOT a part of a Logical partition when you do this, which may involve disconnecting external storage disks(/images for VMs) if you have 4 Primary partitions across all disks. See https://superuser.com/q/856945/1255891 – sinback Mar 09 '23 at 02:00
  • Followup to my guidance for people trying to expand storage in MBR situations. https://answers.microsoft.com/en-us/windows/forum/all/how-to-change-free-space-into-unallocated-space/1a8975a7-0961-4c37-9f78-ddeaefbf7ead also helped me understand the goal - but I didn't use any third-party tools like Greg Carmack suggested in the answer for that post, I just used diskpart and friends. – sinback Mar 09 '23 at 02:04
  • 1
    I just discovered that if one adds or removes a physical drive from the computer in a way that causes the boot disk number to change, then the system will crash loading the boot loader (error 0xc00000f). Running step 5 ("hide the recovery partition") fixes this problem, every time. You just need to boot off an installation media (e.g. USB), drop to the command line, run step 5 and when you reboot the system works again. Thank you a million! You saved my day. – Gili Jun 16 '23 at 19:03
  • For whatever reason I couldn't disable bitlocker on the new recovery partition in the gui. This is how you can do that from the command line: manage-bde -off N: – Tony Salls Jul 21 '23 at 22:33
  • Also, I too noticed the N: drive in file explorer - you need to remove the drive letter from the partition as well as the volume. in diskpart: Select volume N /n Remove -> that should remove it from file explorer. – Tony Salls Jul 21 '23 at 22:39
  • As there is only one single partition on my device, I actually did the following instead: Step 1~2 unchanged 3. Disable recovery
    reagentc /disable
    reagentc /setreimage /path N:\Recovery\WindowsRE
    
    1. Delete the original recovery (and optionally extned the original C:)
    2. Create a new parition for recovery
    3. Apply the recovery
    Dism /Apply-Image /ImageFile:C:\recovery-partition.wim /Index:1 /ApplyDir:N:\
    
    1. Reenable the recovery
    reagentc /enable
    

    8~11 Follow the original 5~8

    – Teng-pao Yu Aug 11 '23 at 09:28
50

I know VainMain's answer from above is probably more careful and thorough, but I've been able to successfully move the partion by simply doing:

  1. In Windows 10: reagentc /disable
  2. In Linux boot CD: Adjust neighboring partition as needed/move recovery partition.
  3. In Windows 10 reagentc /enable

Recovery environment was automatically rediscovered and booted WinRE just fine with all recovery options (Reset/System Image restore/etc). I had only 1 C: partition, no special partitioning/dual booting/multiple recovery partition/crazy BCDEDIT settings beforehand, which helped. Tested inside a VM beforehard to make sure. Had no problems after executing live.

If I remember correctly, skipping the first step (disabling via reangetc) would cause the recovery environment to end up misconfigured, not properly re-bootable, and not easily fixed.

Nick Bolton
  • 3,400
crimshauw
  • 501
  • 3
    Can confirm, worked perfectly. Used DiskGenius to make a new partition at the end of my NVMe. Clone partition into it, delete old, reactivate. If you want to get fancy you can even set it's "file system" to 27: Microsoft Recovery Partition. It's just a hidden NTFS (but you WILL be able to delete from Disk Management, so be careful!). You may use reagentc /info before and after to confirm. – kcdwayne Sep 15 '21 at 02:32
  • 5
    Used a Debian live ISO with Gparted to resize my Windows 11 setup, the process was surprisingly smooth! Thanks for the tip! – Xerz Oct 06 '21 at 18:08
  • 2
    Using linux to move and resize the recovery partition and after that assigning drive letter and using single line from vainMan's answer worked :

    reagentc /setreimage /path N:\Recovery\WindowsRE

    – Gediz GÜRSU Mar 22 '22 at 11:54
  • After moving the partition with gparted and rebooting into Windows, I ran reagentc /enable and got "The Windows RE image was not found". But re-running the same command a few minutes later, it worked. So using a live Linux with "gparted" is definitely the easiest way to do that. – mivk Apr 29 '23 at 16:25
  • 1
    What happens if I move the recovery partition in front on C: partition so that future disk extensions are easier? – Petr May 16 '23 at 11:31
6

Like the person above I was able to do this by

  1. Open Windows Command prompt as admin and run reagentc /info
  • this showed recovery as Enabled, and gave the location on the disk and the BCD identifier.
  1. reagentc /disable
  • reagentc /info showed Disabled, no location and a zero identifier
  1. Shut down and boot into Linux. Move the recovery partition (to the left) with GParted.
  2. Shut down and boot back into Windows. Run reagentc /enable (reported Operation Successful)
  • reagentc /info now showed Enabled, the same location and a new BCD identifier (one digit different).
5

An example how to move Recovery Partition to OS Partition

diskpart
DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 NTFS Partition 617 MB Healthy Hidden

DISKPART> select volume 2 DISKPART> assign letter=F DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> exit

xcopy F:\Recovery C:\Recovery /E /H /I
ReAgentc /info

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk2\partition3\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: b4c3cf2d-1282-11ed-b4c8-b90a37105c4b
    Recovery image location:
    Recovery image index:      0
    Custom image location:
    Custom image index:        0
ReAgentc /disable

ReAgentc /setreimage /path C:\Recovery\WindowsRE /target C:\Windows

ReAgentc /enable
ReAgentc /info

Windows Recovery Environment (Windows RE) and system reset configuration
Information:

    Windows RE status:         Enabled
    Windows RE location:       \\?\GLOBALROOT\device\harddisk2\partition2\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: b4c3cf2f-1282-11ed-b4c8-b90a37105c4b
    Recovery image location:
    Recovery image index:      0
    Custom image location:
    Custom image index:        0

NOTE: Observe that "partition3" changed to "partition2"

delete a Recovery Partition

diskpart
DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info


Volume 0 System Rese NTFS Partition 500 MB Healthy System Volume 1 C Windows11 NTFS Partition 58 GB Healthy Boot Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> select volume 2 DISKPART> detail partition

Partition 3 Type : 27 Hidden: No Active: No Offset in Bytes: 83763396608

Volume ### Ltr Label Fs Type Size Status Info


  • Volume 2 F NTFS Partition 617 MB Healthy Hidden

DISKPART> delete partition override DISKPART> exit

  • when I try to run ReAgentc /setreimage /path C:\Recovery\WindowsRE /target C:\Windows I get the message "The specified path was not found" Should the path be F:\Recovery\WindowsRE ? – mal Sep 17 '22 at 13:39
  • In response to my own comment above - no, the result is the same – mal Sep 17 '22 at 13:43
  • 1
    I obviously made a mistake somewhere along the way, my files were in C:\WindowsRE not C:\Recovery\WindowsRE In any case, this worked perfectly once I figured that out. – mal Sep 17 '22 at 14:24
4

Just as an addition to the answer of VainMan and the comment of haridsv (can't comment myself yet):

I had the same problem. Instead of DISKPART> remove execute mountvol N: /d on the command line. If you already have removed the partition first reassign a drive letter to the new recovery partition with assign letter=N (normally reagentc /info should now show the correct status again, otherwise repeat step 4 of VainMans instructions).

Stumdra
  • 41
  • 3
  • Actually, diskpart's remove and mountvol's /d is the same thing in this specific situation. The illusion was probably created by duplicitous behavior of reagentc's /setreimage and the confusion it created. I don't mean "confusion" here as a personal attack — it confused me as well, for about an hour when I tried the workflow again and again with slight variations, until figuring out the actual behavior. – Jake F Jan 16 '21 at 15:10
  • @JakeF It's not an illusion or duplicitous, it's simply the incorrect sequence of commands was executed, as in order for WinRE's path to be changed, it must be disabled (it's analogous to trying to capture a WIM of C: while booted to Windows) – JW0914 Apr 15 '22 at 12:24