Insights Technical Hub How to extend a disk in Windows using diskpart

How to extend a disk in Windows using diskpart

Introduction:

Sometimes a disk has more space available to an operating system (OS) than what it actually uses. You can extend the size of the space allocated to the OS.

Requirements:

Access to the Windows command line, and optionally a file editor if a scripting method is chosen

Procedure:

You can choose to extend the size of a disk using a diskpart script file, saving it with a .txt file extension and running it with diskpart, or by using the diskpart interactive utility. Once access to the Windows command line is available, start diskpart as follows:

diskpart

This will start the diskpart utility that is native to the Windows environment. Once diskpart is running, you can view the current disk information with:

list disk

This will return something such as:

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 136 GB 87 GB
Disk 1 Online 279 GB 250 GB
Disk 2 Online 931 GB 902 GB
Disk 3 Online 136 GB 107 GB
Disk 4 Online 136 GB 107 GB
Disk 5 Online 93 GB 0 B
Disk 6 No Media 0 B 0 B
Disk 7 No Media 0 B 0 B

You can then view more detailed information about the particular disk using:

DISKPART> select disk 0
Disk 0 is now the selected disk.
DISKPART> detail disk

What you need to determine, is which volume has the OS on it, which can be identified by the volume’s drive letter.

You can list volume information using detail disk or by:

DISKPART> list vol

Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- --------
Volume 0 System Rese NTFS Partition 350 MB Healthy System
Volume 1 C NTFS Partition 48 GB Healthy Boot
Volume 2 E New Volume NTFS Partition 29 GB Healthy
Volume 3 F New Volume NTFS Partition 29 GB Healthy
Volume 4 G New Volume NTFS Partition 29 GB Healthy
Volume 5 H New Volume NTFS Partition 29 GB Healthy
Volume 6 I Volume Name NTFS Partition 93 GB Healthy
Volume 7 J Removable 0 B No Media
Volume 8 L Removable 0 B No Media

You can then select the desired volume:

DISKPART> select vol 1

Volume 1 is the selected volume.

You can see from the help extend command that extending disk size is done in terms of megabytes (MB):

DISKPART> help extend

Extends the volume or partition with focus, and its file system, into free
(unallocated) space on a disk.

Syntax: EXTEND [SIZE=] [DISK=] [NOERR]
EXTEND FILESYSTEM [NOERR]

SIZE= Specifies the amount of space in megabytes (MB) to add to the
current volume or partition. If no size is given, all of the
contiguous free space that is available on the disk is used.

DISK= Specifies the disk on which the volume or partition is
extended. If no disk is specified, the volume or partition is
extended on the current disk.

Then you can extend the disk by the desired amount of space:

DISKPART> extend size=20000

DiskPart successfully extended the volume.

More Information:

For more information within diskpart, type:

help extend