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.

In this article
  1. What Is Diskpart?
  2. Common Diskpart Commands Windows 11/10 Examples | Chart
    1. Active Partition Command
    2. Assign Drive Letter Command
    3. Create Primary Partition Command
    4. Delete Partition Command
    5. Format Partition Command
    6. Shrink Partition Command
    7. Clean-up or Erase Disk Command
    8. MBR to GPT/GPT to MBR Command
  3. How To Open Diskpart in Windows 10/11/8/7?
  4. Recover Partition Easily If Data Loss

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. 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 displays all the disks on your system.
list vdisk displays all the virtual disks on your Windows OS.
list partition/volume displays all the information about the partition/volume on your disk.
select disk/partition/volume* 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 displays detailed information about the specific disk/partition/volume.
create partition primary/logical size=* to create a primary partition. "*" indicates the partition size you want to create in MB.
delete disk/partition/volume * deletes a specific disk, partition, or volume; "*" is the disk/partition/volume number.
convert basic/dynamic/mbr/gpt converts a disk between basic and dynamic or MBR and GPT.
Assign assigns a drive letter to a disk/volume/partition.
Extend expands the focused disk/volume/partition and its file system onto unallocated disk space.
Shrink decreases the size of the specified volume by the amount you choose.
clean/clean all to delete all partitions available on a disk or entirely delete all of the data on a hard disk or SSD.
Format to format a volume or partition and convert its file system to NTFS, FAT32, exFAT, and so on.
Active to make the disk's partition with focus active.

Part 3. 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

To make a selected drive/volume/partition active.

  1. Launch Diskpart, type the command list disk, and press Enter.
  2. Type the command select disk* and hit Enter.
  3. Type list partition and press Enter.
  4. Type the command select partition* and hit Enter. Replace * with the number of the desired partition you want to set as active.
  5. Type active and press the Enter key.
make disk active

Assign Drive Letter Command

To assign a specific drive letter to the selected drive/volume/partition.

  1. Launch Diskpart in Command Prompt. To list all the volumes on your system, type "list volume" and hit "Enter."
    type list volume
  2. After entering the "select volume*" command, press "Enter" and replace * with the number of your partition or drive.
    select the volume number
  3. Enter "assign letter=f" and hit the Enter key.
    assign letter via diskpart

Create Primary Partition Command

To create a new primary partition, simple volume, or logical partition.

  1. Launch Diskpart.
  2. Enter the command list disk.
  3. Type select disk* and press the Enter key; replace * with the disk's number on which you want to create a partition.
  4. To create a partition on the specified disk, enter the relevant command:

    create partition primary size=* or create partition logical size=*
    assign drive letter=*
    format fs=ntfs quick
    (you can replace NTFS with other desired formats like FAT32, exFAT, etc.)
create primary partition

Delete Partition Command

To delete volumes/partitions, wipe or erase partitions, clean disk/volume/partition, or erase HDD/SSD.

  1. Launch Diskpart.
  2. Enter the command list disk.
  3. Press Enter after typing the command list partition.
  4. Type the command select partition* and press Enter.
  5. Type delete partition and hit Enter.
delete partition command

Format Partition Command

To format hard drive or partition, quick format volumes, USB, or external disks.

  1. Launch Diskpart.
  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 quick, or format fs=fat32 quick
format partition command
note
Note: if you want to format multiple partitions, repeat the procedure.

Shrink Partition Command

To reduce the size of the specified partition.

  1. Launch Diskpart.
  2. Type the command list volume and press Enter.
  3. Input the command select volume* and press Enter. Replace * with the number of volumes/partitions you want to shrink.
  4. Type shrink desired=* and hit Enter. Replace * with the size you want to shrink from the specified partition.
shrink partition command

Clean-up or Erase Disk Command

To erase or clean up the entire disk, volume, or partition.

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

  • list disk
  • select disk* (replace * with drive number)
  • clean all
clean up or erase disk command

MBR to GPT/GPT to MBR Command

To transform disk type, change MBR to GPT or GPT to MBR.

  1. Launch Diskpart, type the command list disk, and press Enter.
  2. Input the command select disk* and hit Enter.
  3. Type clean and press Enter.
  4. Enter the command convert mbr or convert gpt and hit Enter.
mbr to gpt command

Part 4. 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

  1. Press Win+R to launch the Run Application.
  2. Type CMD in the Run dialogue box to open Command Prompt and hit Enter to launch the Command Prompt application.
  3. In the Command Prompt window, enter the command Diskpart and hit Enter.
run diskpart in windows 10

Run Diskpart in Windows 11

  1. Hit the Win+S keys to launch the Windows Search Application and type Diskpart in the search bar.
  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

  1. Click the Start menu, go to the Search bar, and type CMD in the search box.
  2. Right-click on the Command Prompt application and select Run as Administrator.
  3. Input Diskpart in the Command Prompt window and press Enter to launch Diskpart.
run diskpart in windows 8

Run Diskpart in Windows 7

  1. Choose Search from the Start menu, then type CMD.
  2. From the results list, select Command Prompt and choose "Run as an Administrator" from the context menu.
  3. In the Command Prompt, type diskpart and press Enter.
run diskpart in windows 7

Part 5. Recover Partition Easily If Data Loss

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
Free Download
  1. Download and launch the Recoverit Data Recovery application and choose the respective deleted partition.
    launching recoverit for partition recovery
  2. Recoverit will Scan all the lost or deleted partitions to recover them.
    scanning deleted partitions
  3. Preview the recoverable partition files to identify which files you want back.
    previewing via recoverit
  4. Click the Recover option to recover the partition after the preview.
Free Download
Free Download

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.

FAQ

  • Do I need to install Diskpart from any external source?
    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.
  • Does the Diskpart Clean command delete all the hard drive data?
    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.
  • Does older Windows versions include Diskpart?
    No! Earlier Windows OS versions had the Fdisk tool instead of Diskpart to manage hard drives and partitions.
  • I accidentally lost a partition by entering the wrong command in Diskpart; what to do next?
    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.
  • Can I format my disk using Diskpart?
    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.
David Darlington
David Darlington Jun 25, 25
Share article: