This post is a guide on how to extend the C drive with unallocated space in Windows 11. If you have unallocated space on your hard drive and want to add it to your C drive, follow these steps.
Step 1: Open Disk Management
If you have unallocated space on you hard drive but when right-clicking on the C drive, the "Extend Volume" option is grayed out, you need to run this command in Command Prompt:
// Disable windows recovery environment
C:\Windows\System32> reagentc /disable
REAGENTC.EXE: Operation Successful.
C:\Windows\System32> diskpart
Microsoft DiskPart version 10.0.26100.1150
Copyright (C) Microsoft Corporation.
On computer: DESKTOP-EXAMPLE
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 150 GB 70 GB *
DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Recovery 300 MB 1024 KB
Partition 2 System 100 MB 301 MB
Partition 3 Reserved 128 GB 401 MB
Partition 4 Primary 78 GB 529 MB
Partition 5 Recovery 642 MB 79 GB
DISKPART> select partition 5
Partition 5 is now the selected partition.
Step 2: Delete the Recovery Partition and Extend C Drive
First we need to copy the partition id and attribute of the recovery partition. Because we need to recreate it after extending the C drive.
DISKPART> detail partition
Partition 5
Type : dexxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # Copy this partition id
Hidden : Yes
Required : Yes
Attrib : 0x8000000000000000 # Copy this attribute
Offset in Bytes : 847083520
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
* Volume 3 C Windows NTFS Partition 642 GB Healthy Hidden
DISKPART> delete partition override
DiskPart successfully deleted the selected partition.
Now we can extend the C drive with the unallocated space in the "Disk Management" window.
Step 3: Recreate the Recovery Partition
After you have extended the C drive, you need to remain at least 1GB of unallocated space to recreate the recovery partition. You can either choose to extend all and shrink the C drive later, or just extend it to the maximum size you want.
Then make your unallocated space a primary partition by right-clicking on it and selecting "New Simple Volume". Follow the wizard to create a new volume.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Recovery 300 MB 1024 KB
Partition 2 System 100 MB 301 MB
Partition 3 Reserved 128 GB 401 MB
// This is the extended C drive
Partition 4 Primary 148 GB 529 MB
// This is the new volume created from unallocated space
Partition 5 Primary 1024 MB 148 GB
DISKPART> select partition 5
Partition 5 is now the selected partition.
// Use the partition id you copied earlier (use "override" if necessary)
DISKPART> set id=dexxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DiskPart successfully set the partition ID.
DISKPART> gpt attributes=0x8000000000000000 # Use the attribute you copied earlier
DiskPart successfully assigned the attributes to the selected GPT partition.
Step 4: Hide the Recovery Partition from Windows Explorer
To hide the recovery partition from Windows Explorer, you can use the following command:
DISKPART> list volume
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
// ... other volumes
* Volume 6 F New Volume NTFS Partition 1024 MB Healthy Hidden
DISKPART> select volume F
Volume 6 is the selected volume.
DISKPART> remove letter=F
DiskPart successfully removed the drive letter or mount point.
DISKPART> exit
Leaving DiskPart...