Get Diskpart Commands Examples to Manage Partitions in Windows 10, 11, 8, and 7

Diskpart allows you to conduct many disk partitioning operations that you can't perform using the Disk Management utility.

diskpart for partition management

Most Windows newbies are probably unaware of Diskpart, a free CMD disk software that aids in managing disk partitions on the computer. However, knowing which diskpart command in windows you should use to perform specific tasks and how to prevent your data from being lost during the execution of these Diskpart commands is necessary. In this article, you will discover how Diskpart operates to monitor disk drives and even how to resolve Diskpart issues like a pro using diskpart commands in Windows 10/11/8/7.

Part 1. What Is Diskpart?

Diskpart is the latest command-line utility for managing disk partitions and has replaced the older fdisk tool. It is supported by all the latest Windows versions and can manage partitions on desktops, laptops, and external storage devices. However, you must know all the basic commands to manage partitions.

Basic Information About Diskpart
Developer Microsoft, Lee Schroeder
Predecessor Fdisk Utility
Initial Release February 17, 2000
Latest Release August 8, 2012
Price Free
Target Users Windows beginners and users with a technical background
Supported OS Windows 11/10/8.1/8/7 and Windows Servers

Part 2. How To Open Diskpart in Windows 10/11/8/7?

Different Windows versions have different interfaces; therefore, if you don't know how to open Diskpart on your Windows edition, don't worry. Depending on your operating system, you can choose from the following four routes to launch Diskpart:

Run Diskpart in Windows 10

Step 1: Press Win+R to launch the Run Application.

Step 2: Type CMD in the Run dialogue box to open Command Prompt and hit Enter to launch the Command Prompt application.

Step 3: In the Command Prompt window, enter the command Diskpart and hit Enter.

run diskpart in windows 10

Run Diskpart in Windows 11

Step 1: Hit the Win+S keys to launch the Windows Search Application and type Diskpart in the search bar.

Step 2: Right-click on Diskpart and choose Run as Administrator from the dropdown menu options.

run diskpart in windows 11

Run Diskpart in Windows 8

Step 1: Click the Start menu, go to the Search bar and type CMD in the search box.

Step 2: Right-click on the Command Prompt application and select Run as Administrator.

Step 3: Input Diskpart in the Command Prompt application window and hit Enter to launch Diskpart.

run diskpart in windows 8

Run Diskpart in Windows 7

Step 1: Choose Search from the Start menu, then type CMD.

Step 2: From the results list, select Command Prompt and choose "Run as an Administrator" from the context menu.

Step 3: In the Command Prompt, type diskpart and press Enter.

run diskpart in windows 7

Part 3. Get Most Common Diskpart Commands Examples in Windows

Diskpart offers a vast array of commands to manage your disk partitions. However, which command should be used to format a volume and which should be used to create a new partition? Check the Windows Diskpart commands mentioned in the table below to understand better which task each one performs.

Diskpart Commands
Function
list disk This command displays all the disks on your system.
list vdisk It displays all the virtual disks on your Windows OS.
list partition/volume It displays all the information about the partition/volume on your disk.
select disk/partition/volume* It is used to select a particular disk, partition, or volume to perform a specific task. "*" indicates the number of a particular disk/volume/partition.
detail disk/partition/volume It displays detailed information about the specific disk/partition/volume.
create partition primary/logical size=* It is used to create a primary partition. "*" indicates the partition size you want to create in MB.
delete disk/partition/volume * It deletes a specific disk, partition, or volume; "*" is the disk/partition/volume number.
convert basic/dynamic/mbr/gpt This command converts a disk between basic and dynamic or MBR and GPT.
Assign It assigns a drive letter to a disk/volume/partition.
Extend It expands the focused disk/volume/partition and its file system onto unallocated disk space.
Shrink It decreases the size of the specified volume by the amount you choose.
clean/clean all It allows you to delete all partitions available on a disk or entirely delete all of the data on a hard disk or SSD.
Format You can use it to format a volume or partition and convert its file system to NTFS, FAT32, exFAT, and so on.
Active This command allows you to make the disk's partition with focus active.

Part 4. Using Diskpart Commands Examples to Manage Partitions in Windows

You can carry out multiple tasks using Diskpart; therefore, commands are carried out one at a time. The outcomes of the previous operation are displayed in the subsequent procedure, and you must press the "Enter" key after each command you input.

Discover how to use the Diskpart commands to manage disk partitions by performing different disk operations, which are mentioned below:

Active Partition Command

Applies to: Make a selected drive/volume/partition active.

Operational Steps:

Step 1: Launch Diskpart, type the "list disk" command, and press Enter.

Step 2: Type the command "select disk*" and hit Enter.

Step 3: Type "list partition" and press Enter.

Step 4: Type the command "select partition*" and hit Enter. Replace * with the number of the desired partition you want to set as active.

Step 5: Type "active" and press the Enter key.

active partition command

Assign Drive Letter Command

Applies to: Assign a specific drive letter to the selected drive/volume/partition.

Operational Steps:

Step 1: Launch Diskpart in Command Prompt. To list all the volumes on your system, type "list volume" and hit "Enter."

type list volume

Step 2: After entering the "select volume*" command, press "Enter" and replace * with the number of your partition or drive.

select the volume number

Step 3: Enter "assign letter=f" and hit the Enter key.

assign letter via diskpart

Create Primary Partition Command

Applies to: Create a new primary partition, simple volume, or logical partition.

Operational Steps:

Step 1:Launch Diskpart.

Step 2: Enter the command "list disk".

Step 3: Type "select disc*" and press the Enter key; replace * with the disk's number on which you want to create a partition.

Step 4: To create a partition on the specified disk, enter the relevant command:

create partition primary size=* or create partition logical =*

assign drive letter=*

format fs=ntfs quick (you can replace NTFS with other desired formats like FAT32, exFAT, etc.)

create primary partition via diskpart

Delete Partition Command

Applies to: Delete volumes/partitions, wipe or erase partitions, clean disk/volume/partition, or erase HDD/SSD.

Operational Steps:

Step 1: Launch Diskpart.

Step 2: Enter the command "list disk".

Step 3: Press Enter after typing the command "list partition".

Step 4: Type the command "select partition*" and press Enter.

Step 5: Type "delete partition" and hit Enter.

delete partition command

Extend Partition Command

Applies to: Extend the disk/volume/partition by increasing size.

Operational Steps:

Step 1: Launch Diskpart, type the "list volume" command, and press Enter.

Step 2: Input the "select volume" command and hit Enter.

Step 3: Type "extendor extend size=*" and replace * with the required size for the selected partition.

extend volume via diskpart

Format Partition Command

Applies to: Format hard drive or partition, quick format volumes, USB, or external disks.

Operational Steps:

Step 1: Launch Diskpart.

Step 2: Input the following commands in sequence, and press Enter each time.

list disk

select disk* (Replace * with the target disk number.)

list volume

select volume* (Replace * with the volume on your drive to be formatted.)

format fs=ntfs quick, or format fs= exFAT/fat32 quick.

Note: if you want to format multiple partitions, repeat the procedure.

 format disk or partition via diskpart

Shrink Partition Command

Applies to: Reduce the size of the specified partition.

Operational Steps:

Step 1: Launch Diskpart.

Step 2: Type the command "list volume" and press Enter.

Step 3: Input the "select volume*" command and press Enter. Replace * with the number of volumes/partitions you want to shrink.

Step 4: Type "shrink desired=*" and hit Enter. Replace * with the size you want to shrink from the specified partition.

shrink volume via diskpart

Clean-up or Erase Disk Command

Applies to: Erase or clean up the entire disk, volume, or partition.

Operational Steps:

Step 1: Launch Diskpart, input the following commands in sequence, and press Enter every time.

list disk

select disk* (Write the drive number in place of *

clean all

erase or clean up disk via diskpart

Convert Disk from MBR to GPT or GPT to MBR Command

Applies to: Transform disk type, change MBR to GPT or GPT to MBR.

Operational Steps:

Step 1: Launch Diskpart, type the command "list disk,"and press Enter.

Step 2: Input the command "select disk*"and hit Enter.

Step 3: Type "clean"and press Enter.

Step 4: Enter the "convert mbr" or"convert gpt" command and hit Enter.

mbr to gpt conversion via diskpart

Part 5. Diskpart Pros and Cons

Although Diskpart is free to operate and addresses common disk management problems, it still has limitations. We have described some of the pros and cons of this CMD disk management utility so that you have complete knowledge about this tool.

Pros

Free

Applicable for all types of users

Enables cross-platforms such as Windows and ReactOS

Provides more operational features than disk management

Available in all the latest Windows versions (7, 8, 10, 11)

Operations processing is quick and straightforward

Cons

A bit complicated for beginner-level users

Neither a confirm nor an undo option

Hard to remember all the commands exactly

Great chances of typing false commands and causing severe issues

Part 6. Recover Partition Easily After Entering Wrong Diskpart Commands

It is challenging to remember all the Diskpart commands with accurate syntax parameters; therefore, there are greater chances of partition formatting, deletion, or erasure. However, if you have entered the wrong Diskpart commands and accidentally deleted the partition or your data is deleted through unintentional formatting.

There's no need to worry. Using powerful and reliable recovery software, you can recover the deleted partition or lost data; Recoverit is the industry leader in recovering your deleted files in seconds.

Free Download

For Windows XP/Vista/7/8/10/11

Free Download

For macOS X 10.10 or later

Operational Steps:

Step 1: Download and launch the Recoverit Data Recovery application and choose the respective deleted partition.

launching recoverit for partition recovery

Step 2: Recoverit will Scan all the lost or deleted partitions to recover them.

scanning deleted partitions

Step 3: Preview the recoverable partition files to identify which files you want back.

previewing via recoverit

Step 4: Click the Recover option to recover the partition after the preview.

FAQs

No! Diskpart is a Windows utility already installed and incorporated into your operating system. You don't need to install it from any external source, nor does it cost you.

The Clean command enables you to delete any or all drive partitions. However, all the data won't be deleted; if you have cleaned only one drive, the data associated with that drive will be deleted.

No! Earlier Windows OS versions had the Fdisk tool instead of Diskpart to manage hard drives and partitions.

The lost partition is only removed from the record of the partition table and is not entirely gone. Therefore, if you have accidentally lost your partition, you can recover it using dependable recovery software.

Yes! Diskpart allows you to format any or all of your disks; you can accomplish this by applying the "format" command to the specified drive. Note that formatting deletes all the drive content, so back up your data into another drive before formatting.

You may also like:
How to Create Partition with Diskpart?
How to Repartition a Hard Drive Without Losing Data on Windows 10/11

Conclusion

We have provided an in-depth explanation of what Diskpart is, what it can perform, why you should use it, and examples of typical Diskpart commands. Diskpart is a more effective Windows utility than disk management for managing your computer's hard disk partitions and external storage devices. However, remembering syntax commands is the only complexity that some beginner users may experience.

Free Download

For Windows XP/Vista/7/8/10/11

Free Download

For macOS X 10.10 or later