Diskpart: Recovering a Memory Card, a USB Flash Drive or a Hard Disk

Read this article to find out what to do if a USB drive, a memory card or another storage device works incorrectly. Cleaning the disk and its partitions with the command Clean and Diskpart tool can become one of the ways to solve the problem. This way, you can fix problems with a drive which can’t be formatted or displays the wrong capacity.

Diskpart: Recovering a Memory Card, a USB Flash Drive or a Hard Disk

The trick will also remove partitions which cannot be deleted with other Windows integrated tools such as Disk Management. This process will completely remove the disk partition table so that you can create it from the scratch.

Attention! It will erase your disk completely so take care to back up your files. Also, it is very important to make sure that you have chosen the right device, otherwise you risk to delete data from the wrong disk.

Launch the Command prompt as Administrator

First of all, start the Command prompt as Administrator. In Windows 10 or 8.1, just right-click on the Start menu and select Command Prompt (Admin).

In Windows 7, find Command Prompt in the Start menu. Right-click and select Run as Administrator.

Run as Administrator

Diskpart

To clean the disk, use the command Diskpart. Before doing it, make sure that the USB drive, memory card or another device you want to clean is connected to the computer.

To run the Diskpart utility, type the corresponding command in the Command Prompt and press Enter:

Diskpart

Diskpart

Use this command to see the list of all disks installed in this computer:

list disk

View the result and decide on the digit of the disk you want to clean.

Be careful! If you choose a wrong disk digit, the disk will be erased and important data may be lost.

In the screenshot below, you can see that Disk 0 has the capacity of 111 GB, Disk 1 – 931 GB, and Disk 2 – 14 GB. We know that we need to work with the disk having 14 GB of space. Then Disk 2 is the USB drive, and Disk 0 is the computer’s system disk, while Disk 1 is its main internal hard disk.

Diskpart

After you’ve decided on the disk digit, type the following command, replacing the symbol # with the disk digit.

Attention! Be very attentive. If you give the wrong disk digit, you may erase all data from the wrong disk.

select disk #

Diskpart

Diskpart has selected the disk you specified. Now all actions you take will affect this disk. To clean the partition table, type the following command and press Enter:

Attention! This command will remove all data from this disk! Make sure you have backed up all important information before you proceed.

Clean

Diskpart

If everything was correct, you will see a message saying the disk was cleaned successfully. Close the Command Prompt.

Creating partitions and disk formatting

Now use a Windows-integrated tool, Disk Management, to create partitions on this disk and format it. This can be done with the diskpart command, too, but it’s much easier with Disk Management.

In Windows 10 or 8.1, you can start Disk Management by right-clicking on the Start menu and selecting Disk Management.

Disk Management

Now you can see that the disk you were dealing with has no partitions at all. Right-click on this unallocated space and select New Simple Volume to create a partition and then format it into the file system you prefer. By default, Windows will create one partition covering the entire disk.

Disk Management

If this method doesn’t work - for example, the disk was cleaned but it can’t be partitioned or formatted, or the diskpart command can’t detect it - it means the disk is damaged physically and is unable to work properly. However, cleaning with the diskpart command is a simple solution capable of reviving seemingly hopeless disks.

The tool recovers data from any devices, regardless of the cause of data loss.

And even if you overlooked all the warnings and cleaned the wrong disk (in fact, it does happen TOO often), don’t get upset. That data can still be recovered. For this purpose, your perfect choice would be a data recovery tool by Hetman Software – Hetman Partition Recovery.

Vladimir Artiukh

Author: , Technical Writer

Vladimir Artiukh is a technical writer for Hetman Software, as well as the voice and face of their English-speaking YouTube channel, Hetman Software: Data Recovery for Windows. He handles tutorials, how-tos, and detailed reviews on how the company’s tools work with all kinds of data storage devices.

Oleg Afonin

Editor: , Technical Writer

Oleg Afonin is an expert in mobile forensics, data recovery and computer systems. He often attends large data security conferences, and writes several blogs for such resources as xaker.ru, Elcomsoft and Habr. In addition to his online activities, Oleg’s articles are also published in professional magazines. Also, Oleg Afonin is the co-author of a well-known book, Mobile Forensics - Advanced Investigative Strategies.

Recommended For You

Hello! This is AI-based Hetman Software virtual assistant, and it will answer any of your questions right away.
Start Chat