Disable Recovery Agent Environment
First, you should check if the recovery agent is using this drive as the recovery environment. You can check this by running reagentc /info
from an Administrator Command Prompt:
C:\Windows\System32>reagentc /info
Windows Recovery Environment (Windows RE) and system reset configuration
Information:
Windows RE status: Enabled
Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition4\Recovery\WindowsRE
Boot Configuration Data (BCD) identifier: 815b3db0-d49c-11ed-be7f-00155d019403
Recovery image location:
Recovery image index: 0
Custom image location:
Custom image index: 0
REAGENTC.EXE: Operation Successful.
The above output indicates that Recovery Agent is configured to use that partition. In the above output, note that harddisk0
(indicating disk 0) and partition4
(indicating partition 4). This should correlate to information you will use in the later diskpart
commands. To disable Recovery Agent on this partition, run reagentc /disable
in an Administrator Command Prompt:
C:\Windows\System32>reagentc /disable
REAGENTC.EXE: Operation Successful.
Now verify that the partition is no longer in use by Recovery Agent by again running reagentc /info
in an Administrator Command Prompt:
C:\Windows\System32>reagentc /info
Windows Recovery Environment (Windows RE) and system reset configuration
Information:
Windows RE status: Disabled
Windows RE location:
Boot Configuration Data (BCD) identifier: 00000000-0000-0000-0000-000000000000
Recovery image location:
Recovery image index: 0
Custom image location:
Custom image index: 0
REAGENTC.EXE: Operation Successful.
The above output indicates that the Recovery Agent is disabled. Notice specifically that there is no indication of a partition being used. Now the Recovery partition no longer serves a purpose, so it can be removed using diskpart. Launch diskpart
in an Administrator Command Prompt:
Force Delete Partition With DiskPart
C:\Windows\System32>diskpart
Microsoft DiskPart version 10.0.22621.1
Copyright (C) Microsoft Corporation.
On computer: DCX-VPN-ANYDESK
List the disks in diskpart. Look for the disk number referred to by the earlier reagentc /info
command. In our example, this was disk 0. Use the list disk
command:
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 64 GB 1024 KB *
Use select disk «disk number»
to choose the appropriate disk. In our example, «disk number» is 0.
DISKPART> select disk 0
Disk 0 is now the selected disk.
Now seek out the partition we want to remove. This should be the partition shown in the first reagentc /info
command. In our example, it was partition 4. Use the list partition
command to list the partitions:
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 100 MB 1024 KB
Partition 2 Reserved 16 MB 101 MB
Partition 3 Primary 63 GB 117 MB
Partition 4 Recovery 664 MB 63 GB
From the above output, it should be clear which partition is the recovery partition. The partition number should match the output from reagentc /info
command earlier and it should show in the listing as a Recovery partition. In this example, we were expecting partition 4 and our listing showed that partition 4 is indeed a Recovery partition. Select this partition using select partition «partition number»
. In our example, «partition number» is 4:
DISKPART> select partition 4
Partition 4 is now the selected partition.
Now you can delete that partition. Note that the following command uses the override
parameter. Be careful and double check what you are doing. The override
parameter means we are performing an operation which DiskPart thinks is dangerous. Recall that the partition we are removing was originally used for the Recovery Agent environment which we disabled above. Recheck that the partition we selected is indeed the partition you wanted to remove. Ensure that if you have any data on your PC, you either have accepted that you might experience data loss or that you have backups and have verified that you can get data out of your backups. If you are certain, proceed with delete partition override
:
DISKPART> delete partition override
DiskPart successfully deleted the selected partition.
You can now list the partitions to show the results using list partition
:
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 System 100 MB 1024 KB
Partition 2 Reserved 16 MB 101 MB
Partition 3 Primary 63 GB 117 MB
We can see above that only the Recover partition was removed and the partition with data that we care about, partition 3, still exists. Proceed by exiting diskpart using the exit
command:
DISKPART> exit
Leaving DiskPart...
C:\Windows\System32>
Reenable Recovery Agent Environment
I recommend that you turn recovery back on at this point. This will set up the Recovery Agent to use an image on your C:
partition. If you need to expand your partition further again, this is more convenient than having a separate partition. However, while more convenient, using the C:
partition does have its risks. Run reagentc /enable
at an Administrator Command Prompt:
C:\Windows\System32>reagentc /enable
REAGENTC.EXE: Operation Successful.
Now check reagentc /info
to see where it put the recovery environment:
C:\Windows\System32>reagentc /info
Windows Recovery Environment (Windows RE) and system reset configuration
Information:
Windows RE status: Enabled
Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition3\Recovery\WindowsRE
Boot Configuration Data (BCD) identifier: 815b3db2-d49c-11ed-be7f-00155d019403
Recovery image location:
Recovery image index: 0
Custom image location:
Custom image index: 0
REAGENTC.EXE: Operation Successful.
You can see from the above output that a path within partition 3 which, in this example, is the C:
partition was used.
Expand Your Primary Partition
You may now use the graphical disk management interface to expand your C:
partition freely.