Many people complain that their data and partition got deleted mistakenly as they run the DiskPart clean command on a wrong drive but don't know how to undo DiskPart clean.

If you are with the same issue, check out the content navigation. You'll find three practical methods to recover data and partition deleted by DiskPart clean command on Windows 10/8/7 with ease: 

Note: Stop using your hard drive and don't save any new data once you've cleaned the disk using diskpart. 

DiskPart Clean Overview

In this part, you'll learn: 1. What is Diskpart clean command; 2. When to use it. 

DiskPart clean

DiskPart.exe is a disk utility in Windows that helps Administrators manage a computer's disk partitions with some commands.

DiskPart clean is a command that overwrites the partitioning information, including hidden sector information or the Protective MBR, on an MBR or GPT Disk. As a result, the command removes all partitions or volumes formatting from the disk. That's why you see data and partition lost after executing this command. 

Notice:
Unlike DiskPart clean, the clean all command is set to write zero to each and every sector on the disk, which completely deletes all data on the disk. It's a way to erase a drive, making data and partition unrecoverable.

As explained, both Diskpart clean and clean all commands will cause serious data loss. It is not suggested to execute frequently as it's a "dangerous" command. So when should you use the DiskPart clean command? 

  • DiskPart clean - Use it when you want to clean a whole drive, it has some errors, or you want to free up disk space for other purposes.
  • DiskPart clean all - Use it when you want to erase the drive or sell the drive, etc.

IMPORTANT: Be more careful while cleaning the drive with this command, your data will be removed. And it can happen at times. 

Can You Undo Diskpart Clean and Recover Files

Can you recover files after Diskpart clean? The answer to this and other similar questions is YES. It's possible to undo the DiskPart command. 

Sometimes, users may execute a wrong command in their storage devices or Windows hard drive partition, accidentally deleted data or deleted the partition by mistake. 

As explained, the DiskPart clean command only deleted data and partition. Therefore, you can still recover files and partitions after DiskPart clean. However, if you executed "clean all" command, undoing diskpart clean in that situation is impossible. 

You may come up with the next question of "How do I restore a partition using diskpart" or "How do I undo a clean command in Diskpart", right?

Follow the methods in the next part, you can undo the operation and bring your data and partition back immediately.

How to Undo Diskpart Clean in Windows 10/8/7 ( 3 Ways)

Now you know the files and partitions are recoverable if you use the diskpart clean command without the "all" parameter. Here, we collected 3 practical methods that can help you recover files and partition on your drive with ease:

  1. #1. Recover DiskPart Cleaned Data and Create New Volume - Safe & Sound
  2. #2. Use Partition Recovery Tool - Easy
  3. #3. Turn to Manual Partition and Data Recovery Service

Solution 1. Run EaseUS DiskPart Recovery Software 

Applies to: 3-step data recovery, recover lost partition with DiskPart command.

One of the practical ways that you can try is to run a reliable DiskPart recovery software to restore lost data first. Then run the CMD command to create new volumes on the drive.

#1. Recover DiskPart Cleaned Data via EaseUS DiskPart Recovery Software

EaseUS Data Recovery Wizard is designed to scan and retrieve the files and folders from your disk from any data loss situations.

With it, you can undo diskpart clean in Windows 10/8/7 and even earlier versions with simple clicks. 

 Download for Win Recovery Rate 99.7%
 Download for Mac Trustpilot Rating 4.7

Follow to recover your lost data in 3 steps:

Step 1. Select a drive to scan

To start recovering DiskPart deleted files, you must determine where the files were kept before deletion. EaseUS Data Recovery Wizard will list all the loaded drives on your PC, so it's for you to select the correct drive to scan. Hover the mouse pointer to the drive and click "Search for Lost Data".

select a location and click scan

Step 2. Check for scanned results

After the scan process, select the deleted or lost file folders in the left panel using the "Path" option. Or, click "Filter" to display only the specified file types, such as pictures, videos, Word documents, PDF files, etc.

filter wanted files

Step 3. Preview and recover

Once located the desired files that were deleted by DiskPart, you can double-click the files one by one for preview, or use the "Preview" button to check its integrity. At last, click "Recover". You shall choose a different drive to save the recovered files to avoid data overwriting, such as OneDrive, Google Drive, etc.

recover diskpart deleted files

Remember to save the found data to another secure location. Then follow the next tutorial to make the DiskPart cleaned drive usable again.

#2. Partition Recovery - Create New Volumes via Diskpart

Now, you can perform partition recovery on your hard drive, USB, or external hard drive with DiskPart.

The command is not a recovery command but you can use it to create new partitions on the drive, making the cleaned drive or USB, SD card usable again:

Step 1. Press Windows + R keys, type cmd in the Run dialogue, and hit Enter. 

Step 2. Type below commands, hit Enter each time to create a new partition:

  • diskpart
  • select disk * (Replace * with the disk number of your drive.)
  • create primary partition size=* (Replace * with the partition size.)
  • assign letter=* (Replace * with a new drive letter.)
  • exit

Create new partition on Diskpart cleaned drive

If you want to create more than one partition on your hard drive, just repeat the above process.

After this, you are good to use the drive or external storage devices and you may save the restored data back to the device again. 

Solution 2. Use Partition Recovery Tool 

Applies to: Recover partition and data together from a DiskPart cleaned drive.

If you want to recover both data and the partitions on the disk, which was cleaned by DiskPart, you can use EaseUS Partition Recovery to get things done. It is exclusively designed for partition and data recovery.

Note that sometimes, if the partition table gets corrupted, a normal partition recovery tool may not be able to detect nor find your lost disk partition. So it is to EaseUS Partition Recovery. In this case, you'll need to revert to Solution 1 and apply data recovery software for help. 

Follow the steps here to restore partitions and files from the disk on which you use the diskpart clean command:

Step 1. Run EaseUS Partition Recovery on your PC.

Select the disk or device where you lost partition(s), click "Scan" to continue.

Select disk to scan lost partition

Step 2. Wait for the scanning process to complete.

Let the program scan the selected disk and find the lost partition(s).

Scan lost partition

Step 3. Preview and restore the lost partition(s).

Double-click on the partition which is marked as "Lost" with "Good" recoverability.

Preview lost partition

Preview the content of the lost partition. Click "OK" and click "Proceed" to start restoring the lost partition.

Select found partition to restore

Step 4. Click "Recover Now" to finish the partition recovery process.

Note: If the program warns you that there is a conflict, back up the listed partition with essential data to an external hard drive first. Then execute the final operation to restore your lost partition.

Finish partition recovery

#3. Turn to Manual Partition and Data Recovery Service

Applies to: Manually undo DiskPart clean, restore data, and partition on a hard drive from a third-party data recovery service.

Note that if the above two methods fail to help you undo the DiskPart clean command, there might be more problems on your disk. And you can turn to a manual partition and data recovery service for help.

Consult with EaseUS Data Recovery Experts for one-on-one manual recovery service. We could offer the following services after FREE diagnosis:

  • Repair corrupted RAID structure, unbootable Windows OS and corrupted virtual disk file (.vmdk, .vhd, .vhdx, etc.)
  • Recover/repair lost partition and re-partitioned drive
  • Unformat hard drive and repair raw drive (BitLocker encrypted drive)
  • Fix disks that become GPT protected partitions

The Bottom Line

On this page, we explained what is DiskPart clean command and the difference between "clean" and "clean all" commands. When you executed a solely clean command on your drive, you may still bring the lost data and partition back.

If you want to undo the DiskPart clean command. First, don't make any changes to your drive. Next, turn to a reliable method for help. If you only used "diskpart clean",  you can recover all your data and partitions using a partition recovery tool, EaseUS DiskPart recovery software, or data recovery service.

 Download for Win Recovery Rate 99.7%
 Download for Mac Trustpilot Rating 4.7

Last, it's also recommended that you make a regular backup of all valuable files on your drive to another secure location. 

Was This Page Helpful?

Updated by Tracy King

Tracy became a member of the EaseUS content team in 2013. Being a technical writer for over 10 years, she is enthusiastic about sharing tips to assist readers in resolving complex issues in disk management, file transfer, PC & Mac performance optimization, etc., like an expert.

Read full bio

Approved by Evan Galasso

Evan Galasso is a digital forensics and data recovery engineer with over 10 years of experience in the field. He presents opinions on the current state of storage media, reverse engineering of storage systems and firmware, and electro-mechanical systems of SSDs and HDDs.

Read full bio