Jump to content
Toggle menu
  • 51 articles
  • 24 files
  • 4 users
  • 750 edits
Tech-Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Expand disks using Diskpart

From Tech-Wiki


Extend a Windows volume with DiskPart, including the recovery-partition scenario where free space is not immediately adjacent to the target volume.

!
Disk and partition operations can destroy data
Confirm the selected disk, volume and recovery partition before using extend, delete partition override or changing partition identifiers. Take an appropriate backup first.

Extend a volume

The original example extends the selected volume by 10 GB. If no size is specified, DiskPart uses the available adjacent space.

DISKPART > list disk
DISKPART > select Disk 0
DISKPART > detail Disk

DISKPART > select Volume 1
DISKPART > extend Size=10000
DISKPART > Exit

When the recovery partition blocks the free space

Disable Windows Recovery Environment:

>_Disable WinRE
reagentc /disable

Use DiskPart to remove the recovery partition:

DISKPART > list disk
DISKPART > select disk #
DISKPART > list partition
DISKPART > select partition 4
DISKPART > delete partition override

Expand the required Windows volume while leaving approximately 1 GB free at the end of the disk for the recovery partition.

Create a new NTFS recovery volume without assigning a drive letter.

Restore the recovery-partition attributes

Select the newly created recovery partition:

DISKPART > list partition
DISKPART > select partition 4

For GPT disks:

DISKPART > set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
DISKPART > gpt attributes=0x8000000000000001

For MBR disks:

>_Set the recovery partition type
set id=27

Re-enable Windows Recovery Environment:

>_Enable WinRE
reagentc /enable

See also