How to fix problem: Can't extend partition C:?

Published: (December 27, 2025 at 03:54 PM EST)
3 min read
Source: Dev.to

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:

Disk Management view

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:

DiskPart partition list

⚠️ 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

  1. Open Computer Management → Disk Management.
  2. Right‑click the C: volume and choose Extend Volume….
  3. 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

  1. Right‑click the Unallocated space → New Simple Volume…Next.
  2. Do NOT assign a drive letter or path – this keeps the partition hidden from File Explorer.
  3. 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)

StepAction
1reagentc /disable
2diskpart
3list diskselect disk 0list partition
4select partition X (X = Linux or Recovery partition)
5detail partitionrecord ID & attributes
6delete partition override
7In 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 /enable if you disabled it in step 1.

Recovery partition illustration

Back to Blog

Related posts

Read more »

WINDOWS HOOKS ARE WEIRD

Hook program cpp LRESULT CALLBACK KeyboardProcint nCode, WPARAM wParam, LPARAM lParam { if nCode == HC_ACTION && wParam == WM_KEYDOWN { KBDLLHOOKSTRUCT kb = KB...