How to use DiskPart to clean and format drive not working on Windows 10 (2024)

How to use DiskPart to clean and format drive not working on Windows 10 (1)

Jump to:

  • Fix MBR drive
  • Fix GPT drive

On Windows 10, you can use the DiskPart tool to resolve virtually any logical problem with a storage drive, and in this guide, I'll outline the steps that I typically use to fix most issues (such as data corruption or other logical problems) using DiskPart.

DiskPart is a command-line tool to manage drives, partitions, volumes, and virtual disks through Command Prompt. Usually, it works better than other tools like "Disk Management" and the "Format" feature available on File Explorer.

On Windows 10, you can have different partition styles, including Master Boot Record (MBR) and GUID Partition Table (GPT). The MBR is the legacy partition style for the standard Basic Input/Output System (BIOS). The GPT is a newer partition style, usually found in Unified Extensible Firmware Interface (UEFI) computers. The difference between the two is that GPT is meant to replace MBR since it supports more than four partitions, and it's required on drives with more than 2TB of space. You typically want to use GPT, but MBR is also a good option for external storage. These instructions will help you use DiskPart on either partition style.

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.

In this how-to guide, I will walk you through the steps to use DiskPart to clean and format a hard drive to fix data corruption and other problems on Windows 10.

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

To fix drive issues on Windows 10 with DiskPart, 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 launch DiskPart and press Enter: diskpart
  4. Type the following command to list all the active drives and press Enter: list disk
  5. Type the following command to select the drive to clean and press Enter: select 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 Enter: clean

How to use DiskPart to clean and format drive not working on Windows 10 (2)

  1. Type the following command to confirm the drive is still selected, and press Enter: list 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 Enter: convert 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 the command 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 Enter: create partition primary
  2. Type the following command to select the new primary partition and press Enter: select partition 1
  3. Type the following command to make the partition active and press Enter: active
  • 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).

How to use DiskPart to clean and format drive not working on Windows 10 (3)

  1. Type the following command to format the partition using the NTFS file system, set a drive label, and press Enter: format 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 hard drive's size. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

How to use DiskPart to clean and format drive not working on Windows 10 (4)

  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 Enter: exit
  2. Type the following command to close Command Prompt and press Enter: exit

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 Enter: diskpart
  4. Type the following command to list all the active drives and press Enter: list disk
  5. Type the following command to select the drive you want to clean and press Enter: select 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 Enter: clean

How to use DiskPart to clean and format drive not working on Windows 10 (5)

  1. Type the following command to confirm the drive is still selected and press Enter: list 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 Enter: convert gpt
  2. Type the following command to create a new partition and press Enter: create partition primary
  3. Type the following command to select the new primary partition and press Enter: select partition 1
  1. Type the following command to format the partition with the NTFS file system, set a drive label, and press Enter: format 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 to perform a format faster. However, if you are unsure about the drive's condition, it is best to skip the option. The format could take a long time, depending on the hard drive's size. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

How to use DiskPart to clean and format drive not working on Windows 10 (6)

  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 sets the "W" letter: assign letter=w

  1. Type the following command to terminate DiskPart and press Enter: exit
  2. Type the following command to close Command Prompt and press Enter: exit

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

More resources

For more helpful articles, coverage, and answers to common questions about Windows 10 and Windows 11, visit the following resources:

  • Windows 11 on Windows Central — All you need to know
  • Windows 10 on Windows Central — All you need to know

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

How to use DiskPart to clean and format drive not working on Windows 10 (7)

Mauro Huculak

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.

As an AI language model, I have a wide range of knowledge on various topics, including computer hardware and software. I can provide information and assistance on fixing drive issues using DiskPart on Windows 10.

DiskPart is a command-line tool that allows you to manage drives, partitions, volumes, and virtual disks through Command Prompt. It is often used to resolve logical problems with storage drives, such as data corruption or other issues.

Fixing MBR Drive Issues with DiskPart on Windows 10

To fix drive issues on Windows 10 with DiskPart using the Master Boot Record (MBR) partition style, you can follow these steps:

  1. Open the Start menu and search for "Command Prompt."
  2. Right-click on the top result and select the "Run as administrator" option.
  3. In the Command Prompt window, type the following command and press Enter: diskpart
  4. Type the following command to list all active drives and press Enter: list disk
  5. Identify the drive you want to repair based on the disk number listed in the "Disk" column.
  6. Type the following command to select the drive and press Enter: select disk DISK-NUMBER (replace "DISK-NUMBER" with the appropriate disk number).
  7. Type the following command to wipe out the drive and press Enter: clean
  8. Confirm that the correct drive is still selected by typing the following command and pressing Enter: list disk
  9. If necessary, convert the drive to an MBR partition style by typing the following command and pressing Enter: convert mbr (this step is only required if the drive is configured as GPT).
  10. Create a new primary partition by typing the following command and pressing Enter: create partition primary
  11. Select the new primary partition by typing the following command and pressing Enter: select partition 1
  12. Make the partition active by typing the following command and pressing Enter: active
  13. Format the partition using the NTFS file system, set a drive label, and press Enter. For example: format fs=ntfs label=myData quick
  14. Assign a drive letter to make the drive available in File Explorer by typing the following command and pressing Enter: assign letter=DRIVE-LETTER (replace "DRIVE-LETTER" with the desired letter).
  15. Terminate DiskPart by typing the following command and pressing Enter: exit
  16. Close Command Prompt by typing the following command and pressing Enter: exit

After completing these steps, the drive should be fixed with an MBR partition style and accessible through File Explorer.

Fixing GPT Drive Issues with DiskPart on Windows 10

To fix drive issues with the GUID Partition Table (GPT) partition style using DiskPart on Windows 10, you can follow these steps:

  1. Open the Start menu and search for "Command Prompt."
  2. Right-click on the top result and select the "Run as administrator" option.
  3. In the Command Prompt window, type the following command and press Enter: diskpart
  4. Type the following command to list all active drives and press Enter: list disk
  5. Identify the drive you want to repair based on the disk number listed in the "Disk" column.
  6. Type the following command to select the drive and press Enter: select disk DISK-NUMBER (replace "DISK-NUMBER" with the appropriate disk number).
  7. Type the following command to wipe out the drive and press Enter: clean
  8. Confirm that the correct drive is still selected by typing the following command and pressing Enter: list disk
  9. Convert the partition style to GPT by typing the following command and pressing Enter: convert gpt
  10. Create a new primary partition by typing the following command and pressing Enter: create partition primary
  11. Select the new primary partition by typing the following command and pressing Enter: select partition 1
  12. Format the partition using the NTFS file system, set a drive label, and press Enter. For example: format fs=ntfs label=myData quick
  13. Assign a drive letter to make the drive available in File Explorer by typing the following command and pressing Enter: assign letter=DRIVE-LETTER (replace "DRIVE-LETTER" with the desired letter).
  14. Terminate DiskPart by typing the following command and pressing Enter: exit
  15. Close Command Prompt by typing the following command and pressing Enter: exit

After completing these steps, the drive should be fixed with a GPT partition style and accessible through File Explorer.

Please note that these steps will erase everything on the selected drive, so it's important to back up any important data before proceeding. Additionally, exercise caution when selecting the drive to avoid accidentally erasing the wrong one.

I hope this information helps! Let me know if you have any further questions.

How to use DiskPart to clean and format drive not working on Windows 10 (2024)

FAQs

Why is diskpart clean not working? ›

The DiskPart Clean command not working can be caused by the reasons below: The target hard drive, USB drive or SD card is not correctly connected to your PC. The disk is locked or write-protected. There are logically bad sectors, corrupted partition tables or physical sectors.

How to use diskpart to fix drive? ›

Let's use the diskpart command to make the drive available for scanning.
  1. Open Command Prompt. Type diskpart and press enter. ...
  2. In the new window, type list volume and hit enter.
  3. Select your main drive. ...
  4. Now type attributes disk clear readonly and hit Enter.
Sep 22, 2023

How to reset hard drive with diskpart? ›

Replies (11) 
  1. During the Windows 10 setup, press Shift + F10 keyboard shortcut to open Command Prompt.
  2. When Command Prompt opens, enter diskpart and press Enter.
  3. Now enter list disk and press Enter. ...
  4. Enter select disk <disk number> and press Enter. ...
  5. Enter clean and press Enter.
  6. Enter exit and press Enter.
Jan 30, 2023

How do I force a hard drive to format? ›

PC Instructions

Right click on the drive and select Format. Enter a name for the drive in Volume label and select the format type in the File system dropdown box. Click OK. It will take a short while to delete all the files and change the format of the disk.

Why is Diskpart not working in command prompt? ›

Unlock Drive, Remove Write Protection. Note that when a storage device is locked, encrypted, or write-protected, you won't be able to access nor make any changes to the drive. So the first thing to fix Diskpart not working error is to unlock, decrypt, and remove write-protection from your target disks.

How to repair or fix corrupted hard drive using CMD? ›

Click on “Start” > type “cmd” > “Run as administrator”. Type a CHKDSK command in the command prompt and press “Enter”. Include parameters like “/f”, “/r”, and “/x” to scan and repair any errors. Note: If you opt to only scan your PC for drive errors, type “chkdsk” and press “Enter”.

How to repair corrupted hard drive using CMD? ›

Run CHKDSK from Command Prompt
  1. Type cmd (or command prompt) in the search box in your taskbar.
  2. Right-click Command Prompt and select Run as Administrator.
  3. Type chkdsk and hit Enter. ...
  4. To run CHKDSK on a drive other than your C drive, specify the volume right after chkdsk.
May 22, 2023

How do I completely wipe my hard drive from command prompt? ›

From the diskpart prompt, type clean and press Enter. The drive's partition, data, and signature is now removed. You will return to the diskpart prompt. Warning: Once you type clean and hit enter the drive will be erased.

What command can be used to totally wipe a hard drive clean? ›

The diskpart clean all command will erase all partitions and wipe your disk to clean all saved data. Make sure to make a backup of all valuable data before you begin.

How do I reset my internal hard drive? ›

How to wipe a hard drive – Windows 11
  1. Press the Windows key.
  2. Type “Settings” to find the Settings app.
  3. Open Settings.
  4. Click Update & Security.
  5. Click Recovery.
  6. Click Reset PC.
  7. Use the Remove everything option.
  8. Chose Local reinstall or Cloud download.

Why won't my computer let me format my hard drive? ›

The drive has the wrong drive format. There's malware or virus infection on the external hard drive. The external hard drive has a damaged hard drive partition. There are bad sectors on the external hard drive.

How do I format a hard drive that is not responding? ›

Here's how to reformat a drive that's showing as RAW or with an Unsupported File System:
  1. In Run (Windows + R), type diskmgmt.
  2. Go to Disk Management, right-click the external hard drive, and select "Format".
  3. Choose a file system like NTFS or exFAT and tick "Quick format". Click "OK" to start the formatting.
Jan 9, 2024

How long does Diskpart clean take? ›

Diskpart clean, according to most users and experts, is a technique. Everything on the drive can be deleted in as little as 1-2 minutes. However, the clean all command in Diskpart will take a little longer, around 4-5 minutes, because it will erase all saved files and remove all partitions on the target device.

How long does Diskpart clean all take to run? ›

When the word “DiskPart succeeded in cleaning the disk” appears, type "exit" and press Enter to close the elevated command prompt window. Q: How long does Diskpart clean all on SSD take? A: "Clean all" command will take around an hour per 320GB to finish running since it performs a secure erase.

Is Diskpart clean safe for SSD? ›

Diskpart's CLEAN ALL writes zeros to every sector of the disk, same as data shredding software would do. If this disk is an SSD then doing so should be avoided. Writing to every sector will reduce the life of the SSD. Instead you should use the manufacturer's Secure Erase option.

How do I clean all data in Diskpart? ›

To clean a disk:
  1. At a command prompt, type diskpart.
  2. At the DISKPART prompt, type select disk 0.
  3. At the DISKPART prompt, type clean all.
  4. At the DISKPART prompt, type exit.
Jul 20, 2021

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 5564

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.