> > Undo Diskpart Clean Command

Clean on Wrong Disk? Undo Diskpart Clean Command Now!

  • Contents:


    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! "
    --from 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".

    about clean

    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.

    Warning:
    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".


    Now let's begin…

    clean disk

    • 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.



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

      Important: 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.


      partition recovery wizard

      Step 2: skip the Welcome page to go on.

      welcome page

      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.

      choose disk

      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.

      choose scaning range

      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 scaning method

      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.

      explore found partitions
      find test 1
      find test 2

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

      choose partitions to recover

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

      apply partition recovery

      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, MiniTool Power Data Recovery is of great significance.

    MiniTool Power Data Recovery 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 Power 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:

    image

    Before we do:
    Download MiniTool Power Data Recovery Free Edition and install it in on computer. Note that this freeware is capable of scanning and recovering lost files on Windows PC OS, but can only be used to scan files on Windows Server OS.



    Step 1: open MiniTool Power Data Recovery to get the main interface, and we can see 5 different functional modules are displayed. Then, choose "Lost Partition Recovery" to start.

    Why choose "Lost Partition Recovery"?
    "Lost partition 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 "Lost Partition Recovery" module to recover data from diskpart clean.


    lost partition recovery

    Step 2: select the disk which is cleaned by diskpart and press "Full Scan" button in the lower right corner to start a full scan. (Note that if the cleaned disk is a removable disk, we need to connect it to computer and then press "Refresh" button to reload current hard disk drives)

    scan cleaned hard drive

    Step 3: when the full 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.)

    check 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 that it is recommended to choose another hard disk drive as the storage location, for fear that we may need to redo data recovery from the source disk.)

    store files

    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.

    NOTE: Free Edition of MiniTool Power Data Recovery has a 1GB data recovery limitation as it is designed for us to have an experience on whether it is useful before we pay a penny. If it is proved to be useful and we have got more data to retrieve, we may need to purchase a license to break the limitation. Press the button below to upgrade to Personal license or more advanced versions.


    Summary


    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 MiniTool Power Data Recovery 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 support@minitool.com. Much appreciated!