How to recover a damaged USB flash drive disk with Diskpart on Windows

- Advertisement -

How to recover a damaged USB flash drive disk with Diskpart on Windows. Make sure you read the instructions before you go any further with the guide.

- Advertisement -

Contents

Instructions

  1. Make sure you read all warnings before attempting the operation
  2. Disclaimer: UgTechMag won’t take responsibility for any lost data. Therefore make sure all data is backed up before continuing.
  3. Operations done by diskpart cannot be undone therefore you should be conscious while performing these operations.

What is diskpart?

Diskpart is a command-line windows utility that comes pre-installed with windows. It can be used for various purposes. This includes formatting/cleaning disks, extending disks, partitioning, and deleting.

Some of the time, the external storage devices may not work as expected. This includes showing the wrong size compared to the actual size, failure to copy, cut or paste files.

In cases where the usual format tool fails to fix the problem is where the diskpart clean comes in. The diskpart clean fixes 99% of the issues with external storage devices.

Read also: USB drive showing less size fixed

How to recover a damaged USB flash drive with diskpart on Windows

Warning: Diskpart clean cannot be undone. All information lost from the operation cannot be restored. It is therefore recommended to backup all data on the computer before performing diskpart clean.

These steps will walk you through the whole process of using the Windows diskpart clean utility.

We shall use a flash drive of storage size 4GB for purposes of illustration but the same steps apply to all external storage devices of various sizes where cleaning of the entire disk is necessary.

Confirm disk number of the USB flash drive

Make sure the external storage device intended for the operation is connected.

You should, first of all, confirm the size and number of the disk to clean.

To confirm the disk details, open disk management.

To open disk management, search for “disk management”.

From the bottom left of the disk management window, locate the 4Gb storage device described as online.

locate USB flash drive in disk management

Right-click on the device and select properties, navigate to the volumes tab. Note the disk number as it will be required by the dispart utility. In this case, it’s “Disk 1“.

note disk number of the USB flash drive

Open command prompt

Open the command prompt. Alternatively, a PowerShell for windows 10 can be used.

To open the command prompt, search for “cmd” from the Start menu, right-click on it and click on “run as administrator”

open command prompt from trh start menu

A message dialog with the message “Do you want to allow the following program to make changes to this computer” will be displayed, click yes to proceed to the command prompt window.

Open diskpart

From the command prompt, type “diskpart” and press Enter.

open diskpart with "dispart" command

This will open the diskpart utility, it may open it in the same command prompt window or in a different command prompt window.

Warning: Diskpart clean cannot be undone. All information lost from the operation cannot be restored. It is therefore recommended to backup all data on the computer before performing diskpart clean.

List available disks

Type “list disk” and press Enter. This will display a list of the disks available with their disk numbers, status, and size.

list available disks with "list disk" command

Confirm disk number and select the disk

Check to see if the disk intended for the operation is listed. Confirm the disk number as noted in step 1.

Warning: Diskpart clean cannot be undone. All information lost from the operation cannot be restored. It is therefore recommended to backup all data on the computer before performing diskpart clean.

Type “select disk <number>” for example “select disk 1” which is our disk number in this case and press Enter.

A message will appear that “disk 1 has been selected

select disk with the USB flash drive

This will select the disk as the subject to all the next operations.

Clean the selected disk

Type “clean” and press Enter. This will erase/clean the disk. All data will be deleted permanently.

Erase data on the flash drive with the "clean" command

Warning: Diskpart clean cannot be undone. All information lost from the operation cannot be restored. It is therefore recommended to backup all data on the computer before performing diskpart clean.

No warning will be displayed once you hit the enter button.

Once the cleaning is done, the command prompt will display a message that “DiskPart succeeded in cleaning the disk“.

success message after cleaning

At this stage, all the data USB flash drive will be erased.

Create a primary partition for the USB flash drive

Type the “create part primary” command and press Enter. Success message – “Diskpart succeeded in creating the specified partition”

Type “select part 1” and press Enter. Success message – “Partition 1 is now selected”

Type “active” and press Enter. Success message – “Diskpart marked the current partition as active”

Type “format fs=fat32 label=”<add label>”” and press Enter. Just be patient until the format is done, it will take a few minutes.

create and format primary partition on the USB flash drive

Once the format is complete, a success message will be displayed. Type “exit” then press Enter to close the diskpart utility.