• Donate
    TheWindowsForum.com needs donations to stay online!
    Love TheWindowsForum.com? Then help keep it alive by sending a donation!
Resource icon

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

WELCOME TO THEWINDOWSFORUM COMMUNITY!

Our community has more than 63,000 registered members, and we'd love to have you as a member. Join us and take part in our unbiased discussions among people of all different backgrounds about Windows OS, Software, Hardware and more.

How to use DiskPart to clean and format drive not working on Windows 10​

By Mauro Huculak
published 13 days ago
If a drive is causing problems on Windows 10, it could be a logical issue that can be fixed with a few commands.

1673533007384.png

DiskPart fix drive on Windows 10 (Image credit: Future)

On Windows 10, when an external drive (USB flash drive, SD card, or secondary drive) stops working due to data corruption or another logical problem, you can use DiskPart to erase everything and start from scratch again.


DiskPart is a command-line tool to manage drives, partitions, volumes, and virtual disks through Command Prompt, which typically works better than other tools, such as Disk Management and the Format feature available in File Explorer.

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 typically found in Unified Extensible Firmware Interface (UEFI) devices. 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 usually want to use GPT, but MBR is also a good option for external drives. These instructions will help you use DiskPart on either partition style.


These instructions 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 you have multiple drives connected to your device, disconnect them to avoid selecting the wrong device.

This guide 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 use DiskPart to fix storage drive issues on Windows 10, 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.

6.Type the following command to wipe out the drive and press Enter: clean

1673533333932.png


(Image credit: Future)
7.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.
8.(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 drive is currently configured as GPT, and you must use MBR partition style. If the partition is already MBR, you don't need 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.
9.Type the following command to create a new partition and press Enter: create partition primary
10.Type the following command to select the new primary partition and press Enter: select partition 1
11.Type the following command to make the partition active and press Enter: active
  • Quick tip: You only need to set a partition as active when using the MBR (Master Boot Record) partition style. 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 need to set up a GPT partition style, use the other steps (see below).

1673533613502.png


(Image credit: Future)
12.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 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 in 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. Remember that depending on the hard drive's size, the format could take a long time. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

1673533659196.png



(Image credit: Future)
13.Type the following command to assign a letter and make the drive available in File Explorer, and press Enter (as needed): 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

14.Type the following command to terminate DiskPart and press Enter: exit

15.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 now be available through File Explorer, and you can begin to store files on it.
If you determine that the external storage has an issue related to hardware and you need a replacement, we recommend the Western Digital My Passport because it offers up to 5TB of reliable storage and has a compact design at a reasonable price.

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 you want to repair as it appears in the "Disk" column.

6.Type the following command to wipe out the drive and press Enter: clean

1673533825498.png



(Image credit: Future)

7.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.
8.Type the following command to convert the partition style to GPT and press Enter: convert gpt
9.Type the following command to create a new partition and press Enter: create partition primary
10.Type the following command to select the new primary partition and press Enter: select partition 1
11.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 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 in 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. Remember that depending on the hard drive's size, the format could take a long time. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

1673533964709.png



(Image credit: Future)
12.Type the following command to assign a letter and make the drive available in File Explorer, and press Enter: assign letter=DRIVE-LETTER
In the command, change DRIVE-LETTER for the letter you want the drive to use, which is not assigned to another device. This example assigns the "W" letter: assign letter=w

13.Type the following command to terminate DiskPart and press Enter: exit

14.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.

  • Like
Reactions: AFFASocial
Author
Hotrod369
Views
2,085
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Hotrod369

Back