If you’re dealing with a USB flash drive or external hard drive that’s not working correctly on Windows 10 (perhaps it’s inaccessible, corrupted, or not formatting properly), you can use the DiskPart command-line tool to wipe and restore the storage to a working condition.

DiskPart is a powerful built-in utility that allows you to manage storage at a low level, including cleaning and reformatting drives, creating partitions, and converting partition styles. It often works better when tools like “Disk Management” or the “Format” option in File Explorer fall short, especially if a drive has logical errors or won’t initialize.

Windows 10 supports two partition styles: Master Boot Record (MBR) and GUID Partition Table (GPT).You may like

  • MBR is the traditional format, compatible with legacy BIOS systems.
  • GPT is the modern standard, used in systems with UEFI firmware. It’s more robust and supports drives larger than 2TB, as well as more than four primary partitions.

While GPT is generally preferred, especially for newer devices and internal drives, MBR remains useful for external drives and compatibility with legacy systems. This guide covers how to use DiskPart to clean and format a drive using either of the two partition styles.

In this how-to guide, I’ll outline the steps to use DiskPart to clean and format a hard drive, fixing data corruption and other issues on Windows 10.

Warning: These steps will erase everything on the selected drive, and you cannot undo the changes. If the drive is still accessible, it’s recommended to back up the data before proceeding. If multiple drives are connected to your device, disconnect them to avoid selecting the wrong one.

Recent updates

These instructions has been updated to ensure accuracy and reflect changes to the process in the operating system.

How to fix drive (MBR) problems with DiskPart on Windows 10

To fix hard drive issues on Windows 10 with DiskPart, use these steps:

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.Contact me with news and offers from other Future brandsReceive email from us on behalf of our trusted partners or sponsorsBy submitting your information you agree to the Terms & Conditions and Privacy Policy and are aged 16 or over.

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to launch DiskPart and press Enterdiskpart
  4. Type the following command to list all the active drives and press Enterlist disk
  5. Type the following command to select the drive to clean and press Enterselect disk DISK-NUMBER

In the command, replace “DISK-NUMBER” with the drive number you want to repair as it appears in the “Disk” column. You could erase the wrong drive if you do not perform this step correctly. Proceed with caution.

  1. Type the following command to wipe out the drive and press Enterclean
DiskPart clean GPT drive
(Image credit: Mauro Huculak)
  1. Type the following command to confirm the drive is still selected, and press Enterlist disk
  • Quick note: The output should include an asterisk (*) next to the selected drive. If the correct storage is not specified, perform step 5 again.
  1. (Optional) Type the following command to convert the drive to an MBR partition style and press Enterconvert mbr
  • Quick note: This step is only required if the storage is configured as GPT, and you must use MBR partition style. If the partition is already MBR, you don’t have to run the command, but running it won’t affect the process. You should be able to determine the partition type with the “list disk” command. If the drive doesn’t have a GPT mark (*), it’s an MBR partition.
  1. Type the following command to create a new partition and press Entercreate partition primary
  2. Type the following command to select the new primary partition and press Enterselect partition 1
  3. Type the following command to make the partition active and press Enteractive
  • Quick tip: You only have to set a partition as active when using MBR. You can determine if the drive uses an MBR or GPT partition style with the “list disk” command. If the partition has a mark in the GPT column, it’s not an MBR partition. If you have to set up a GPT partition style, use the other steps (see below).
DiskPart convert mbr
(Image credit: Mauro Huculak)
  1. Type the following command to format the partition using the NTFS file system, set a drive label, and press Enterformat fs=FILE-SYSTEM label=DRIVE-LABEL quick

In the command, replace “FILE-SYSTEM” with the name of the file system to use, such as “NTFS” or “FAT32,” and replace “DRIVE-LABEL” with the name of the drive as you want it to appear on File Explorer. The quick” option isn’t required, but it will perform a format faster. However, it’s best to skip the option if you are unsure about the drive’s condition. The format could take a long time, depending on the size of the hard drive. This example formats the drive using the NTFS file system and names the partition “myData”: format fs=ntfs label=myData quick

DiskPart format drive
(Image credit: Mauro Huculak)
  1. Type the following command to assign a letter and make the drive available on File Explorer, and press Enter: assign letter=DRIVE-LETTER

In the command, change “DRIVE-LETTER” for the letter to use on the drive, which is not assigned to another device. This example assigns the “G” letter: assign letter=g

  1. Type the following command to terminate DiskPart and press Enterexit
  2. Type the following command to close Command Prompt and press Enterexit

Once you complete the steps, if the drive does not have physical issues, it should be accessible again through File Explorer.

How to fix drive (GPT) problems with DiskPart on Windows 10

To use DiskPart to fix drive issues with GPT partition style, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to run DiskPart and press Enterdiskpart
  4. Type the following command to list all the active drives and press Enterlist disk
  5. Type the following command to select the drive you want to clean and press Enterselect disk DISK-NUMBER

In the command, replace “DISK-NUMBER” with the drive number to repair, as it appears in the “Disk” column.

  1. Type the following command to wipe out the drive and press Enterclean
DiskPart clean GPT drive
(Image credit: Mauro Huculak)
  1. Type the following command to confirm the drive is still selected and press Enterlist disk
  • Quick note: The output should include an asterisk (*) next to the selected drive. If the correct storage is not specified, repeat step 5 one more time.
  1. Type the following command to convert the partition style to GPT and press Enterconvert gpt
  2. Type the following command to create a new partition and press Entercreate partition primary
  3. Type the following command to select the new primary partition and press Enterselect partition 1
  4. Type the following command to format the partition with the NTFS file system, set a drive label, and press Enterformat fs=FILE-SYSTEM label=DRIVE-LABEL quick

In the command, replace “FILE-SYSTEM” with the name of the file system you want to use, such as “NTFS” or “FAT32,” and replace “DRIVE-LABEL” with the name of the drive as you want it to appear on File Explorer. The quick option is optional for faster formatting. However, if you’re unsure about the drive’s condition, it’s best to skip this option. The format could take a long time, depending on the size of the hard drive. This example formats the drive using the NTFS file system and names the partition “myData”: format fs=ntfs label=myData quick

DiskPart format GPT partition
(Image credit: Mauro Huculak)
  1. Type the following command to assign a letter and make the drive available on File Explorer, and press Enterassign letter=DRIVE-LETTER

In the command, change “DRIVE-LETTER” for the letter to use on the drive, which is not assigned to another device. This example sets the “W” letter: assign letter=w

  1. Type the following command to terminate DiskPart and press Enterexit
  2. Type the following command to close Command Prompt and press Enterexit

After you complete the steps, the drive should be fixed with a GPT partition style and accessible from File Explorer.

Finally, it’s worth noting that support for Windows 10 will end on October 14, 2025. After this date, Microsoft will no longer release security or maintenance updates and will also cease to provide any support.

You can use these instructions to prepare your device and upgrade from Windows 10 to 11.

https://www.windowscentral.com/how-clean-and-format-storage-drive-using-diskpart-windows-10

Leave a Reply