How to Use DiskPart Commands in Windows 10?

June 24, 2016

DiskPart is a command-line utility in Windows 10, which enables you to perform disk partition operations by using DiskPart command prompt. Learn how to use DiskPart with the examples.

What is DiskPart?

DiskPart, replacing its predecessor - fdisk, is a command-line utility that provides the ability to manage disks, partitions or volumes in your computer running all versions of operating system since Windows 2000, also including the latest Windows 10. Users can input DiskPart commands directly to organize hard disk partitions, or create a text file script to perform multiple commands. Most commands that you can use in Disk Management tool are integrated in DiskPart.

How to Open DiskPart in Windows 10?

You will need to launch Windows 10 DiskPart with Administrator permission. One way is to type "diskpart" in the Search box, and then when diskpart appears in the search results, right-click it and select "Run as administrator". The other way is to press "Windows logo + R" keys and type "diskpart" in the box, and then click "OK".

Open DiskPart Windows 10

DiskPart Windows 10 Commands and Examples

Before you can use DiskPart commands, you must first list, and then select an object to give it focus. When an object has focus, any DiskPart commands that you type will act on that object.

At the DISKPART> prompt, type "list disk" to display all the disks in your computer. Each one will have a disk number, starting with 0. An asterisk (*) under Gpt row means the disk is GPT partition style. Unless there is only one disk, you will have to tell DiskPart which disk to manage by using "select disk n" to give it focus. n represents the number of the disk.

List Disk

At the DISKPART> prompt, type "list volume" to display all the volumes on all disks. Each one will have a volume number, starting with 0. To tell DiskPart which volume to manage, you need to type "select volume n" to give it focus. n can be the number of the volume or the drive letter of the volume if has.

List Volume

To view what DiskPart can for you, just type help to see a list of commands.

DiskPart Commands

In this article, we will take some of the most common commands that Diskpart uses for examples.

Most Common Commands on Volume in Windows 10

Because when select a volume, the focus remains on it until you select a different volume, so select volume command may not be used in each operation. Besides, the examples are performed one after one and the effect of the previous operation will be viewed in the next operation. If you only need to perform one of the operations, you need to select the volume before using corresponding command.

Note: Each time you type a command, you need to press "Enter" key to apply it.

  • Delete Volume

  • To delete a volume, please refer to the following command:

    • Type "list volume".
    • Type "select volume 6" (here take F: drive for example).
    • Type "delete volume".

And then, you will receive a message says: DiskPart successfully deleted the volume.

Note: You cannot delete the system volume, boot volume, or any volume that contains the active paging file or crash dump.

Delete Volume

  • Create Partition

  • To create a partition, please refer to the following command:

    • Type "create partition primary size=102400".

And then, you will receive a message says: DiskPart succeeded in creating the specified partition.

Create Partition

The above command means to create a 102400MB (100GB) primary partition. To create other type of partition, you just need to replace primary with one of the followings:

Create Partition Type

Note: To create a partition, there must be unallocated space on the disk.

  • Format Partition

  • Type list volume command, you will find the new created partition is RAW, which means you must format partition before you can use it. To format a partition, please refer to the following command:

    • Type "format fs=ntfs label="Windows 7" quick".

And then, you will receive a message says: DiskPart successfully formatted the volume.

The above command means to perform a quick format on the partition whcih will formatted with NTFS file system and labeled as Windows 7. To create other file system partition like FAT, FAT32, you just need to replace ntfs with fat or fat32. The label can be any name as you like.

Format Partition

  • Assign Drive Letter

  • A partition without a drive letter will be hidden under "File Explorer". To assign a drive letter to an existing partition, please refer to the following command:

    • Type "assign letter=F" (F can be replaced with another letter that has not been used yet).

And then, you will receive a message says: DiskPart successfully assigned the drive letter or mount point.

Assign Drive Letter

  • Extend Partition

  • To extend a partition, please refer to the following command:

    • Type "extend size=20480".

And then, you will receive a message says: DiskPart successfully extended the volume.

The above command means to add 20480MB (20GB) to the volume 6. If no size is given, all of the contiguous unallocated space on its right side will be added.

Extend Partition

Note: To extend a partition, there must be contiguous unallocated space on its right side.

  • Shrink Partition

  • To shrink a partition, please refer to the following command:

    • Type "shrink desired=10240".

And then, you will receive a message says: DiskPart successfully shrunk the volume by 10GB.

Shrink Volume

Note: You can reduce the size of a volume only if it is formatted using the NTFS file system.

  • Mark Partition as Active

  • To mark a partition as active, please refer to the following command:

    • Type "active".

And then, you will receive a message says: DiskPart marked the current partition as active.

Mark as Active

Most Common Commands on Disk in Windows 10

  • Clean Disk/Convert Disk to GPT/ Convert Disk to MBR

  • To delete all partitions or volumes on a disk and convert the disk between MBR and GPT, please refer to the following command:

    • Type "list disk".
    • Type "select disk 1".
    • Type "clean".
    • Type "convert gpt" or "convert mbr".

Clean Convert Disk

Free Alternative to Windows 10 DiskPart Utility

As DiskPart alternative, AOMEI Partition Assistant Standard is a free partition manager software and disk management tool, which provides more features than DiskPart. It not only supports Windows 10, but also supports Windows 8.1/8, Windows 7, Vista and XP.

It is very easy to use. To perform an operation on a partition, you just need to right-click on it. The operations supported by AOMEI Partition Assistant are as below:

AOMEI Partition Related Operations

The operations of disk management and step-by-step wizards are as below:

AOMEI Disk Related Tasks

DiskPart in Windows 10 can meet the basic requirement of most users. However, AOMEI Partition Assistant Standard enables you to perform advanced operations on disk partitions in Windows 10 without data loss. You can download this freeware and have a try.