Here's how you can use DiskPart to clean and reformat a drive in Windows 10.
In Windows 10, when you have an external storage (such as a USB flash drive, removable hard drive, or SD card) that has stopped working as a result of data corruption or another problem, you can use DiskPart to delete everything correctly and start a new layout with a clean apartment.
The DiskPart is a command tool that even existed before Windows 10 and allows you to use the Command Prompt to manage disks, partitions, and volumes when other tools such as Disk Management and Formatting will not work to resolve the issue.
In this Windows 10 wizard, we will guide you through the steps to use the DiskPart command tool to clean and format a hard drive that has been corrupted or has other problems.
To fix a problematic hard disk with DiskPart in Windows 10, follow these steps:
Important: These instructions will delete everything on the drive you select, and your changes will not be undone. If the drive is still accessible, it is recommended that you create one backups of its data before continuing. If you have several drives connected to your device, it is recommended that you install them disconnect to avoid making the wrong choice.
1. Press Win + X at the same time and click “Command Prompt (Administrator)".
A new black Windows 10 command prompt window will open.
2. Type the following command there to start DiskPart and press Enter:
3. Type the following command to display all active drives and press Enter:
4. Type the following command to select the drive you want to clean and press Enter:
select disk 0
In this command, make sure to replace 0 with the drive number you want to repair. If you do not perform this step correctly, you could remove an incorrect drive. Follow the specific DiskPart command carefully.
5. Type the following command to delete everything from the drive and press Enter:
6. Type the following command to confirm that the drive is still selected and press Enter:
Note: The output must include an asterisk (*) next to the selected drive.
7. Type the following command to create a new partition and press Enter:
create partition primary
8. Type the following command to select the new primary partition and press Enter:
Select Partition 1
9. Type the following command to activate the partition and press Enter:
10. Type the following command to format the partition using the NTFS file system and set a drive label and press Enter:
format FS = NTFS label = iGuRu quick
In the command, remember to replace the data for the drive name by putting what you want to appear in File Explorer. Also the flag quick is optional to move the format faster and you should not use it unless you are sure that the drive has no bad sectors. The only downside to skipping the "quick" option is that the formatting will take a long time.
11. Type the following command to assign a letter and make the drive available in File Explorer and press Enter:
assign letter = g
In the command, replace g with the letter of the drive you want to use, which is not currently assigned by another drive.
12. Type the following command to quit DiskPart and press Enter:
13. Type the following command to close the command prompt and press Enter:
Once you have completed the steps, and as long as the drive does not have a hardware problem, it should be available through File Explorer and you can start saving files to it.