How to fix problem: Can't extend partition C:?
Source: Dev.to
Why This Happens
When you try to extend the C: drive in Windows, the operation fails if there is any partition (healthy, recovery, or Linux) located between C: and the Unallocated space.
In the screenshot below you can see the typical layout in Disk Management:
In many cases the blocking partition is a Recovery partition, but in my situation it is an Ubuntu (Linux) partition that sits between C: and the unallocated space (the space that used to be the D: drive).
Step‑by‑Step Guide
1. Disable Windows Recovery Environment
Open Command Prompt as Administrator and run:
reagentc /disable
This disables the Windows Recovery Environment (WinRE) so that the recovery partition can be removed if needed.
2. Launch DiskPart
diskpart
3. Identify the Disk and Partitions
list disk # shows all disks – usually you’ll work with Disk 0
select disk 0
list partition # displays every partition on the selected disk
You’ll see something similar to the screenshot below:
⚠️ LOSING DATA IN THE NEXT STEPS
If you do not need the Linux system (or the recovery partition), the following steps will delete it permanently.
4. Select the Partition That Blocks the Extension
-
If it’s a Linux partition (as in my case):
select partition 6 # The partition number will differ on each machine. Choose the one that sits **between** **C:** and the unallocated space.
5. Record Partition Details (Very Important)
detail partition
Take note of the Type, ID, and GPT attributes displayed. You will need these values later to recreate the partition (if you want to keep it).
6. Delete the Blocking Partition
delete partition override
After the deletion, return to Disk Management – the partition you just removed will no longer appear.
7. Extend the C: Drive
- Open Computer Management → Disk Management.
- Right‑click the C: volume and choose Extend Volume….
- Follow the wizard, allocating the newly‑available unallocated space to C:.
(Optional) Re‑Create the Deleted Partition
If you deleted a Recovery or Linux partition and want to restore it (perhaps with a smaller size), follow these steps:
8. Create a New Simple Volume
- Right‑click the Unallocated space → New Simple Volume… → Next.
- Do NOT assign a drive letter or path – this keeps the partition hidden from File Explorer.
- Finish the wizard.
9. Set the Correct Partition ID and Attributes
Return to Command Prompt (Admin) → diskpart and run:
list partition
select partition 9 # replace with the number of the newly created partition
Now apply the previously saved values:
set id=<your‑saved‑id>
gpt attributes=<your‑saved‑attributes>
Replace <your‑saved‑id> and <your‑saved‑attributes> with the exact strings you recorded in step 5. After these commands, Disk Management will show the newly‑created partition with the correct type and attributes.
TL;DR (Quick Checklist)
| Step | Action |
|---|---|
| 1 | reagentc /disable |
| 2 | diskpart |
| 3 | list disk → select disk 0 → list partition |
| 4 | select partition X (X = Linux or Recovery partition) |
| 5 | detail partition → record ID & attributes |
| 6 | delete partition override |
| 7 | In Disk Management → Extend Volume on C: |
| 8 (optional) | Re‑create the deleted partition (no drive letter) |
| 9 (optional) | set id=… & gpt attributes=… to restore original type |
Support
If you find this guide useful, feel free to buy me a coffee 😇
Note: At the end, don’t forget to re‑enable the Windows Recovery Environment with
reagentc /enableif you disabled it in step 1.


