Using Diskpart: manage and recover a hard drive, memory card or USB flash drive

The built-in Diskpart utility is a useful tool for correcting logical errors and restoring hard drives, flash drives, and other storage devices.

How to use Diskart


  1. Getting started with Diskpart
  2. How to create partitions and format an erased disk?
  3. How to delete protected, active, and system partitions on my hard drive?
  4. How to recover lost files?

Incorrect drive operation, incorrect size display in the explorer, inability to format, and other problems – all of these problems make the use of flash drives and hard drives much more difficult, so if you find the above problems, you should immediately resort to troubleshooting them.

Important: Before you begin, you should take care to save the information on the problem drive, as fixing the problem drives will require a complete erase, as well as deleting the partition table, which will certainly delete all information.

Getting started with Diskpart

First, connect the problem flash drive to your computer or determine the exact drive you need. Make this is to avoid accidentally erasing a normally functioning drive with valuable information. In our case, the problem drive will be a 14.4-gigabyte flash drive.

How to use Diskart

After that, you should run the command prompt or Windows PowerShell with administrator rights. You can do this by right-clicking on “Start” and selecting the appropriate item (command line(s) or Windows PowerShell(s)).

How to use Diskart

In the opened command line window you should enter the “Diskpart” command and press Enter (the Enter button confirms the commands, so you should press it after each new command) to start working with the utility.

How to use Diskart

Now you need to identify the problem disk in the utility accurately. To do this, enter the command “list disk”, which displays the entire list of connected media.

How to use Diskart

As you can see from the screenshot, the utility has detected two disks: disk 0 with the size 111 gigabytes and disk 1 with the size 14 gigabytes. Since the system disk with a large size works fine, and the problems are exactly with a 14 gigabyte USB flash drive, we remember that in Diskpart it is called “Disk 1”.

Important: In this point you need to pinpoint the drive you need so that you do not delete all information from the system drive.

Select the problem drive with the “select disk 1” command (if the user has additional drives installed, after the command select disk you should enter the number corresponding to the problem drive).

How to use Diskart

The next step is the final one, so we recommend that you double-check the correctness of the selected drive. Once the command is complete, all data will be erased. To erase the selected drive, enter the “Clean” command and confirm Enter.

How to use Diskart

After erasing the drive, Diskpart will display a message “DiskPart succeeded in cleaning the disk”. You can then close the “Windows PowerShell” window.

It is worth noting that for the erased disc to work correctly, you need to create partitions on the disc and format it.

How to create partitions and format an erased disk?

An erased disk needs to be partitions on it and formatted in the correct file system. To do this, you will need to do the following:

Open the “Disk Management” menu by right-clicking on the “Start” button, and selecting the corresponding item.

How to use Diskart

In the window that opens, we find an erased disk. Usually, it has no letter or does not appear in the menu, but it can be detected as an unallocated area at the bottom of the window. Right-click on an unallocated space and select the first item “Create a simple volume”

How to use Diskart

In the windows that open, you should select a letter and the file system and disk size. By default, the system selects the maximum size, the letter, and the NTFS file system, so you can click “Next” in this item.

How to use Diskart

How to delete protected, active, and system partitions on my hard drive?

To delete hard disc partitions, you can use the functionality of the built-in Disk Management utility. You can right-click on the desired partition and select “Delete volume…”

How to use Diskart

In some cases, it may not work because..:

  • The logical disk has a corrupted file system (you can fix it by checking Chkdsk).
  • It has failed sectors and bad blocks (you can fix the problem by checking with the free program Victoria).
  • Logical disk is protected from deletion (system partitions, hidden and service partitions, etc. are protected from deletion).

However, there are several ways to remove absolutely any partition.

Deletion via command prompt in a running OS

To remove unwanted protected partitions in running Windows, you can use the command line and the built-in Diskpart utility. This method will remove all problematic partitions except for system and service ones.

To do this:

Step 1: Open a command prompt as administrator and enter the following commands one by one: diskpart, list disk, select disk 0 (in our case the partition is located on disk 0), list part (the command opens a list of partitions on the disk).

Step 2: select the desired partition with the command select partition 4, after that we enter the command delete partition to delete the partition.

Step 3: The final step is creating a new partition and formatting it. Enter one by one: create partition primary, format fs=ntfs quick, assign letter Z (the command assigns a letter to the created partition) and exit.

After performing these actions, the previously locked partition will be ready for use, deletion and other manipulations in Disk Management menu.

How to delete any partition

To delete system, reserved, and hidden partitions, the user will need a bootable flash drive or an installation disk. Boot from them and in the language selection menu press Shift+F10 to open the command line.

How to use Diskart

In the command line, similar to the previous method, we enter the commands: diskpart, list disk, select disk 0, lis part, select partition 2 (or any other partition that cannot be removed) and remove it with the command del par override.

It should be noted that the command del par override removes absolutely any partition, regardless of its attributes.

Important: Deleting some partitions on a disk may affect its operation, so we recommend that you not resort to deleting protected partitions.

How to recover lost files?

Often when manipulating a drive through the command prompt, users accidentally format the wrong drive or perform actions that cause important data to be lost.

In addition, it is not uncommon to wipe and format a drive and not have all the important data stored in a safe place.

One way or another, all these actions lead to the loss of important information, which, in turn, can even lead to financial losses, as the value of the data is getting higher every year.

If any of these situations happened to you and you lost important files – do not rush to despair

Better yet, use RS Partition Recovery — a professional tool for recovering lost data.


The program is very convenient in use which appreciably sets it apart from competitors, and allows to restore the lost files practically in a few mouse clicks.

But the most important thing is that RS Partition Recovery supports ALL modern file systems. It means that no matter the device type (computer, server, smartphone) or file system type – you will be able to recover important information.

RS Partition Recovery -- supporting all modern file systems

Plus, one more very useful feature of RS Partition Recovery is the deep disc scan mode. Thanks to it you will be able to recover even files that were lost several months ago.

Frequently Asked Questions

Den Broosen

About Den Broosen

Author and site editor for RecoverySoftware. In his articles, he shares his experience of data recovery on a PC and the safe storage of information on hard drives and RAID arrays.
Leave a comment
Online Chat with Recovery Software