There are numerous users who complain that they have accidentally erased their data and partitions by running the DiskPart clean command on the wrong drive, and they don't know how to undo DiskPart clean.

If you are in the same boat, please check out the content navigation. You will find three practical methods that can easily recover data and partitions deleted by DiskPart clean command on Windows 10/8/7:

Important: After using Disk Cleanup to clean your hard drive, stop using the drive and do not save any new data to it.

DiskPart Clean Overview

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

DiskPart clean

DiskPart.exe is a disk utility in Windows that helps administrators manage disk partitions on a computer through a set of commands.

The DiskPart clean command is one that wipes partition information from an MBR or GPT disk, including hidden sectors or a protective MBR. This means that it removes all partition or volume formatting information from the disk. That's why you lose your data and partitions after running this command.

Note:
Unlike the clean command in DiskPart, the clean all command writes zeros to every sector on the disk, completely erasing all data on the disk. This is one way to sanitize a drive so that data and partitions cannot be recovered.

As mentioned above, the Diskpart clean and clean all commands can lead to severe data loss. As it is a “risky” command, it is not recommended to run frequently. So, when should you use the DiskPart clean command?

    • DiskPart clean - Use this command when you want to clean a whole disk, it has some errors, or you want to free up disk space for other purposes.
    • DiskPart clean all - Use this command when you want to wipe a disk, or in cases where you're planning to sell the disk, etc.

Important: Be careful when using this command to clean a drive, as your data will be deleted. This is not uncommon.

Is it possible to undo Diskpart Clean and recover files?

Can files be recovered after executing Diskpart clean? The answer to such a question is yes. It is possible to undo the DiskPart command.

Sometimes, users might execute wrong commands on the storage device or accidentally delete data or format the partition on Windows hard drive.

As mentioned above, the DiskPart clean command only removes data and partitions. Hence, you can still recover files and partitions after DiskPart clean. However, if you executed the "clean all" command, you cannot undo DiskPart clean in this case.

Now you might have follow-up questions like “How to recover partition with diskpart” or “How to undo clean command in Diskpart”, right?

Using the method in the next section, you may be able to undo the operation and recover your data and partition.

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

Now you know that without the “all” parameter, the Diskpart clean command can remove files and partitions. Here, we have compiled 3 practical methods to help you easily recover files and partitions from your drive:

    1. Recover Data and Create New Volume After DiskPart Cleaning Safely - Secure and Reliable
    2. Use a Partition Recovery Tool - Easy and Straightforward
    3. Seek Manual Partition and Data Recovery Services

Solution 1: Run the DiskPart utility to recover the software

Applies to: 3-step data recovery, recovering lost partitions with the DiskPart command.

One practical approach you can try is to first run a reliable DiskPart recovery tool to restore your lost data. Then run the CMD command to create a new volume on the drive.

#1. Recover Data Using the DiskPart Utility If you've accidentally erased data using DiskPart, you can attempt to restore it with specialized DiskPart data recovery software. These tools typically scan your hard drive to locate and recover deleted or lost files. Here's a general process: 1. **Select a Recovery Tool**: Look for a reliable DiskPart data recovery tool, such as tools Data Recovery Wizard, Recuva, or Stellar Data Recovery. 2. **Download and Install**: Download the software from its official website and follow the instructions to install it on your computer. 3. **Run the Software**: Launch the data recovery application, and you'll see a main interface. 4. **Choose the Disk**: In the software, select the hard disk partition that was cleaned by DiskPart. 5. **Scan the Disk**: Click "Scan" or a similar button to initiate a thorough scan, during which the software will search for lost files and partitions. 6. **Preview and Recover**: After the scan is complete, you can preview the found files. Select the files you want to recover and click "Recover" to save them to a secure location. Keep in mind that the success rate of data recovery depends on several factors, including whether new data has been written to the drive after the cleanup. It's crucial to use a recovery tool as soon as possible and avoid writing new data to the affected disk to increase the chances of successful recovery.

Data Recovery Wizard Pro is designed to scan and retrieve files and folders from your disks in case of any data loss situation.

With it, you can easily undo diskpart clean in Windows 10/8/7 or even earlier versions with a click.

Follow these three steps to recover your lost data:

Step 1. Select the disk to scan

To start the recovery of files deleted with DiskPart, you need to determine where the files were stored before they were deleted. The Data Recovery Wizard tool will list all drives loaded on your computer, so you can select the correct one for scanning. Hover the mouse pointer over the drive, then click “Scan.”

Select a location, then click “Scan.”

Step 2: Review the scan results

Once the scan is finished, select the “Deleted Files” and “Other Lost Files” folders on the left. Then, click “Filter” to display specific file types, such as images, videos, Word documents, PDFs, and so on.

Select the files to recover

Step 3: Preview and recover

After DiskPart deletes the files, you can preview them one by one by double-clicking or check their integrity with the "Preview" button. Finally, click "Recover". To avoid data overwriting, you should select a different disk to save the recovered files.

Recover files deleted by diskpart

Remember to save the recovered data to a safe location. Then proceed to the next tutorial to make the drive cleaned with DiskPart usable again.

#2. Partition Recovery - Creating a New Volume using Diskpart

Now, you can use DiskPart to recover partitions from your hard drive, USB, or external hard drive.

This is not a recovery command, but you can use it to create new partitions on a drive, making a wiped drive or USB/Sd card usable again:

Step 1: Press the Windows + R keys, then type cmd in the Run dialog box and press Enter.

Step 2. Enter the following commands to create your new partitions, pressing Enter after each:

    • diskpart
    • select disk * (replace * with your disk number)
    • create partition primary size=* (replace * with the desired partition size in MB or GB)
    • assign letter=* (replace * with the new drive letter you want to assign)
    • exit

Create new partition on the disk which has been cleaned in Diskpart Create new partition on the disk which has been cleaned in Diskpart

If you want to create more than one partition on the hard drive, repeat this step.

Thereafter, you can use the drive or external storage device and save the recovered data back to the device.

Solution 2: Use a partition recovery tool

Applies to: Recover partitions and data from a drive that was cleared with DiskPart.

If you want to recover data and partitions from a disk cleaned with DiskPart, you can use the Partition Recovery tool, which is designed for partition and data recovery.

Note that if the partition table is damaged, common partition recovery tools may fail to detect or find the lost disk partition. Therefore, you need a more professional partition recovery tool. In this case, you need to go back to Solution 1 and get assistance from data recovery software.

Follow the steps in this article to restore partitions and files from a disk that used the Diskpart clean command.

Step 1: Run the “Partition Recovery” tool on your computer.

Select the disk or device where the lost partition was and click “Scan” to continue.

Select the hard drive where you want to scan for lost partitions.Select disk to scan lost partition

Step 2: Wait until the scanning process is completed.

Have the program scan the selected disk for lost partitions.

Scan for lost partitions

Step 3: Preview and recover the lost partitions

Please double-click on the partition that is labeled as "Lost" and has a recoverability status of "Good".

Preview lost partitions

Preview the contents of the lost partition. Click “OK,” and then click “Proceed” to start the recovery of the lost partition.

Select the found partition to recover

Step 4: Click "Resume" to finish the partition recovery process.

Note: If the utility reports conflicts, back up the partitions that contain important data to an external hard drive before proceeding with the final step to restore the lost partition.

Finish partition recovery

#3. Switch to Manual Partitioning and Data Recovery Services

Applies to: Manually reversing a DiskPart clean operation by using a third-party data-recovery service to recover data and partitions from a hard disk.

Note that if both methods fail to help you undo the DiskPart clean command, there might be more issues with your disk. In that case, seek assistance from manual partitioning and data recovery services.

Tool Data Recovery Service

Contact our experts for a free assessment.

Consult with our Tool Data Recovery specialists for one-on-one manual recovery assistance. After a free diagnosis, we offer the following services:

  • Repair damaged RAID structures, unbootable Windows OS, and corrupted virtual disk files (e.g., .vmdk, .vhd, .vhdx)
  • Recover/repair lost partitions and repartitioned drives
  • Reformat hard drives and fix original drives (including BitLocker encrypted drives)
  • Repair disks turned into GPT protected partitions

Bottom line

In this article, we explain what the DiskPart clean command is and the difference between the “clean” and “clean all” commands. When you execute the clean command only on a drive, there's still a chance to recover lost data and partitions.

If you want to undo the "DiskPart clean" command, first of all, do not make any changes to the drive. Next, seek a reliable solution to help you. If you only used "diskpart clean", you can use partition recovery tools, DiskPart recovery software, or data recovery services to restore all your data and partitions.

Finally, it's recommended that you back up all important files on your hard drive regularly to another secure location.