Have you ever cleaned a wrong disk? That is very terrible. However, if you read this post, the problem may not confuse you, because you are able to find several solutions to find your lost data back. Each method’s specific steps and screenshots are provided in the text, so you don’t have to worry you will get mixed.

While scanning the main portals and forums, we found many users are asking how should they recover data/partition after using diskpart clean command mistakenly:

Q:"So I know I should of been paying a little more attention but wasn't and now am in a major panic of losing ALL my data, I was using the windows7 diskpart command in the command prompt and accidentally used the 'clean' command on the wrong disk. What is the BEST method/program to restore the partition or data would you suggest? Background of what I was doing: I was in the processes of trying to make a bootable usb key (which I had in the other port) BUT stopped as soon as I did the clean command as I immediately noticed my error. I have now disconnected that usb HD so I won't possibly overwrite any of the data. Thanks in advance! "cnet.com

By reading the above question, we know the author is eager to find a way to restore the partitions or data. In this post, we will go through what is diskpart clean, and how to undo diskpart clean command in two ways.

What Is Diskpart Clean?

According to Microsoft, diskpart clean is a command that will remove any and all partitions or volumes from a disk. On master boot record (MBR) disks, only the MBR partitioning information and hidden sector information are overwritten. On GUID partition table (GPT) disks, the GPT partitioning information, including the Protective MBR, is overwritten; there is no hidden sector information. The disk state after cleaning is "Uninitialized".

clean disk

When Should We Use Diskpart Clean?

If an USB flash drive, SD card, or another drive isn’t working quite right, cleaning the drive and removing its partitions is one possible solution. This can fix problems like Windows cannot complete the format or a hard drive is showing the wrong capacity.

This trick also works on partitions that can’t be deleted with normal tools, like the graphical disk-partitioning tool Disk Management. The process will completely erase the partition table from a disk, allowing us to set it back up again.

Thus, we should be very careful to specify the correct disk when using this command, or maybe a backup of the needed drive in advance is necessary to avoid unexpected data loss, for we may accidentally wipe the wrong disk.

Note: Another similar command is named "clean all", which will specify that each and every sector on the disk is zeroed, and completely deletes all data contained on the disk. In this case, even data recovery software cannot help. So be sure you want to recover data after diskpart clean instead of "clean all".

How to Undo Diskpart Clean Command?

If we happen to use diskpart clean on wrong disk, then we should find out the way to undo diskpart clean command as soon as possible. In this post, we think two ways are feasible, and they are partition recovery and data recovery.

Note: Wrong diskpart clean won’t happen on the system disk we are boot from, for once we type the clean command and press Enter key, we will receive the following error message: Virtual Disk Service error: Clean is not allowed on the disk containing the current boot, system, pagefile, crashdump, or hibernation volume. For more information, please refer to the post Why Volume Saving Crash Dump, Hibernation and Page Files Cannot Be Deleted?

Thus, how to recover partition or recover data from the disk that suffers from wrong diskpart clean is a real concern. What’s the real solution? Just keep reading.

Note: Once diskpart clean is carried out, please stop making any changes to the hard drive to ensure the possibility of data recovery to the largest extent.

To offer a clearer demonstration, we will show a real example:

We will use diskpart clean to empty disk 1 in Windows 10; Disk 1 is divided into partition D and partition E; Before cleaning, partition D stores a folder named "test-1" and partition F stores a folder named "test-2".

partition recovery wizard

Now let's begin:

Undo diskpart clean command by recovering partition

Compared with data recovery, recovering partition after diskpart clean is a more preferred way because it will not only get cleaned data back, but also keep these data in their original partitions. Here we just need the help of a professional partition recovery software. We think MiniTool Partition Wizard is the best choice for it has been proved useful by many users.

MiniTool Partition Wizard contains six editions: Free, Pro, Pro Ultimate, Server, Enterprise and Technician. Among these six editions, Free, Pro and Pro Ultimate are available on Windows 10/8/7/Vista/XP, while the rest three are compatible with Windows Server and Windows PC OS.

Partition Recovery is a paid feature that can be found on Pro, Pro Ultimate, Server, Enterprise and Technician Edition. Take the Pro Edition for example here. Let's see how it works to recover partition after diskpart clean.

Before we do:

Buy MiniTool Partition Wizard Pro Edition or download the Trial Edition from the official website, then install and launch it to the main interface.

Buy Now

Step 1: select "Partition Recovery Wizard" from the Wizards menu.

Note: If it was a GPT disk that encounters diskpart clean command, after the clean it would be turned to an MBR disk in Partition Wizard and not initialised in Disk Management. In this case, please first of all convert MBR disk to GPT, and then employ the Partition Recovery feature.

continue the process

Step 2: Click Next to go on.

select disk for recovery

Step 3: Now choose a disk to recover. Remember it's disk 1 that needs to undo diskpart clean command in our example? However in MiniTool Partition Wizard, disk number starts with "1" instead of "0" that appears in Disk Management. So here we should choose disk 2 and click "Next" to go on.

scanning range settings

Step 4: here we need to set scanning range for the selected disk. Since partition loss happens on the whole drive, we choose "Full Disk" and continue.

  • Full Disk: this will scan the whole disk to find the lost partitions.
  • Unallocated Space: this will only cover the unallocated space to find the lost partitions.
  • Specified Range: this enables to choose a partition block to scan. Also it allows us to enter the starting LBA and ending LBA directly.

set scanning methods

Step 5: here choose a scanning method. Normally it is suggested to choose "Quick Scan" at first for time-saving. If it doesn't find the lost partitions, turn to "Full Scan". Continue.

choose Quick Scan

Step 6: surprise! MiniTool Partition Wizard has found the lost two partitions! Now let's have a check on the data in these two partitions. Double-click a partition and we can view the tree structure of the files/folders in it. See "test-1" and "test-2" are also found there.

choose searched partitions

partition explorer

Step 7: now tick the partitions we need and click "Finish".

finish the process

Step 8: finally, press "Apply" button to execute all operations.

apply the operation

That's all! For a more intuitive guidance on how to recover partition after diskpart clean, watch this video:

Tip: The partitions recovered by MiniTool Partition Wizard lack drive letters, thus, we won't see these partitions under Windows Explorer. To make them visible, we should add drive letters to them. Please refer to Change Drive Letter to learn the method.

"Using MiniTool Partition Wizard to undo diskpart clean is really very useful, the concise interface and guidance will lead us to go through all the processes easily and quickly…" Click to Tweet

Undo diskpart clean command by recovering data

Another way to undo diskpart clean is to do data recovery only, which is reliable to find the original data after diskpart clean, and even part of the original data after some changes have been made to the cleaned hard disk drive. In this case, the data recovery feature of MiniTool Partition Wizard is of great significance.

MiniTool Partition Wizard is one of the best data recovery solutions for Windows that has gained great reputation all around the world. This program also includes five editions, and they are Free, Personal, Commercial, Enterprise and Technician. With this professional data recovery assistant, we can not only recover data after diskpart clean, but also retrieve data from formatted/RAW drives, scratched CD/DVDs, and so on. Know more…

Note: Although Data Recovery is helpful to undo diskpart after we have made some changes to the target drive, depending on the real situation, there is also a possibility that the data recovery may fail. Remember the less changes we have made to the hard drive, the higher possibility there is to retrieve more data.

Suppose we are trying to undo diskpart clean command after we have created a small new partition on the target disk, here is how we can made it:

undo diskpart clean command

Before we do:

As MiniTool Partition Wizard Free and Pro Edition don’t support the data recovery function, download MiniTool Partition Wizard Pro Ultimate or above editions and install it in on computer instead.

Step 1: Open MiniTool Partition Wizard to get the main interface, and we can see the data recovery is displayed on the top of the main page. Then, choose the disk that the missing partition is located on to start.

Data Recovery is specially designed to recover data from hard drives where partitions are deleted or get lost by some reasons. We know by using diskpart clean, all partitions and data are deleted. Thus we suggest making use of the data recovery feature of MiniTool Partition Wizard to recover data from diskpart clean.

data recovery

Step 2: select the partition which is cleaned by diskpart and press the Scan button in the lower right corner to start scanning.

Note: If the cleaned disk is a removable disk, we need to connect it to computer and then press the Scan button to reload current hard disk drives.

scan the drive

Step 3: when the scan is finished, all possible partitions are found and parts of them are listed in the next interface of this data recovery software for Windows. Now, we just unfold the RAW partition and try our best to find all needed files & folders. (Note that we can make use of the "Filter" and "Preview" feature to help analyze the correct data.)

save the files

Step 4: After checking the boxes in front of the needed files, we can click "Save" button to select a most suitable location to store all these files.

Note: It is recommended to choose another hard disk drive as the storage location, for fear that we may overwrite data recovery from the source disk.

select a drive to save recovered data

Step 5: After all files & folders are saved to the appointed disk, we can go there to have a check. If all data are retrieved and are in sound condition, we can recreate partitions on the hard drive to make use of it.

Conclusion

Here comes to the end of this post. In this post, we have talked about what is diskpart clean command, when it is employed and how can we undo diskpart clean command if this was carried out on a wrong disk.

In a word, to undo diskpart clean, we can choose to recover the partitions containing original data in whole by using MiniTool Partition Wizard OR we can choose to recover data from the hard drive by using the data recovery of MiniTool Partition Wizard at first, recreate partitions secondly and rearrange these data to the new partitions at last.

No matter which way we choose, we should keep this in mind: avoid overwriting the hard drive, otherwise the possibility to recover data from cleaned hard drive is tiny.

To get a better understanding of the tools mentioned in this post, we suggest users download the free editions to have a try. If users have any questions or suggestions towards this issue, please leave us comments in the following comment area or just sent us email to [email protected]. Much appreciated!

  • Linkedin
  • Reddit