Support

How to fix drive problems with DiskPart on Windows 10

  • Document NO.

    2023110302

  • Category

    SoftwareOS
  • Rev.

    A1

  • Update Date

    2023-11-10

Model Name

All Model

Purpose

Have problems with a particular drive? It could be a logical issue that can be fixed with a few commands — here's how on Windows 10.

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

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, DiskPart can help properly erase everything and start clean with a new partition.
DiskPart is a legacy command-line tool designed to manage drives, partitions, volumes, and virtual disks using Command Prompt, which usually works better than other Windows 10 tools, such as Disk Management and the File Explorer Format feature.
In this Windows 10 guide, we will walk you through the steps to use the DiskPart command-line tool to clean and format a hard drive to fix data corruption and other problems.
Important: 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, it's recommended to disconnect them to avoid selecting the wrong device.

Type the following command to confirm the drive still selected and press Enter:
lisk disk
Quick note: The output should include an asterisk (*) next to the selected drive.
Type the following command to create a new partition and press Enter:
Create Partition Primary

Type the following command to select the new primary partition and press Enter:
select partition 1
Type the following command to make the partition active and press Enter:
active
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 more quickly. However, if you are not sure about the drive's condition, it is best to skip the option. Just remember that depending on the hard drive's size, the format could take a long time.
This example formats the drive using the FAT32 file system and names the partition "Data":
format fs=fat32 label=Data quick

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 "G" letter:
assign letter=g

Type the following command to terminate DiskPart and press Enter:exit
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.