How to Fix a Corrupted USB Flash Drive in Windows Using DiskPart

What is DiskPart and Why Use It?

If your USB flash drive is suddenly unreadable, shows the wrong storage capacity, or throws a “Windows was unable to complete the format” error, the drive’s file system or partition table might be corrupted. Before throwing the drive away, you can often revive it using a built-in Windows command-line tool called DiskPart.

DiskPart bypasses the standard Windows graphical interface and forcefully wipes the drive clean, allowing you to create a fresh, healthy partition. Warning: This process will permanently erase all data currently on the USB drive. Proceed only if you have already backed up your data or if the data is unrecoverable anyway.

Step 1: Open the Command Prompt as Administrator

You must run DiskPart with administrative privileges.

  1. Click the Start button (or press the Windows key).
  2. Type cmd into the search bar.
  3. Right-click on Command Prompt and select Run as administrator.
  4. Click Yes on the User Account Control prompt.

Step 2: Identify Your USB Drive

You need to find the correct disk number for your USB drive to avoid accidentally erasing your computer’s main hard drive.

  1. In the Command Prompt window, type diskpart and press Enter. You will see the prompt change to DISKPART>.
  2. Type list disk and press Enter.
  3. A list of all connected drives will appear. Identify your USB drive by looking at the Size column. Note the disk number (e.g., Disk 1, Disk 2).

Step 3: Clean the Drive

Now we will select the corrupted drive and wipe it clean.

  1. Type select disk X (replace X with the number of your USB drive from the previous step) and press Enter. You should see a message saying “Disk X is now the selected disk.”
  2. Double-check that you have selected the correct disk.
  3. Type clean and press Enter. This command removes all formatting and partition information from the drive. It should only take a few seconds, and you will see a success message.

Step 4: Create a New Partition and Format

With the drive wiped clean, it’s time to create a new partition so Windows can use it again.

  1. Type create partition primary and press Enter.
  2. Type select partition 1 and press Enter.
  3. Type active and press Enter (this step marks the partition as active).
  4. Next, we need to format the drive. For most modern USB drives, the exFAT file system is best as it works on both Windows and Mac. Type format fs=exfat quick and press Enter. (If you prefer NTFS, use format fs=ntfs quick instead).
  5. Once the format reaches 100%, type assign and press Enter to give the drive a drive letter (like E: or F:).
  6. Type exit and press Enter to leave DiskPart, and close the Command Prompt window.

Your USB flash drive should now appear normally in Windows File Explorer and be ready for use.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.

Receive our best articles and tips delivered straight to your inbox.