By Emily / Last Updated March 4, 2022

Can you undo Diskpart clean using CMD?

When you delete or clean partition accidentally in Diskpart, you may think you will lose all your data once and for all. Definitely, if your partition table and boot sector of the select disk were removed, there is no chance to recover deleted partition. If not, you can recover it.

In general, the system only removes partition information (eg: partition type, size, location, file system, etc.) from partition table when you delete a partition.

Matters you should pay attention to

As mentioned above, the system just removes partition information instead of completely wiping the area occupied by deleted partition.

To ensure you can recover data or partition, pay attention to the following things.

1. Do to run any operation on this partition.

2. Do not add new items to this partition.

3. Do not reformat this partition.

How to recover deleted partition using CMD?

Sometimes, loss of volume label, drive letter, partition name or Diskpart clean command can result in partition loss issue. If these happen to the causes of partition loss, you can try to assign drive letter using Diskpart. This operation can undo Diskpart clean using CMD.

Step 1. Find the deleted partition in Disk Management.

1. Press Win + R to summon the Run window.

2.Type diskmgmt.msc in the pop-up window and then press OK to open Disk Management.

3. Find the deleted partition and remember its partition size. Usually, the deleted partition will be marked as Unallocated.

Step 2. Type cmd in the search box and run as administrator.

Step 3. Type diskpart in the window and press Enter.

Step 4. Type the following commands in order and hit Enter.

  • list disk

  • select disk n (n refers to the disk which contains the deleted partition.)

  • list volume

  • select volume m (m refers to the number of the lost partition.)

  • assign letter=r (r refers to a drive letter which cannot be used before. )

Recover Deleted Partition using CMD

Step 5. Exit this window and see if Diskpart undo delete partition.

If you are not familiar with command prompt, you’d better try the following method. And if you delete all partitions on the disk, you cannot undo Diskpart clean using CMD.

An Easier Way to recover deleted partition in Windows 11/10/8/7

To recover deleted partition with an easier, you can empoly AOMEI Partition Assistant Professional. Compared with CMD, it’s easier to learn and operate.

AOMEI Partition Assistant can be used to do more things, such as, delete EFI system partition, move partition to end of disk, convert GPT disk to MBR, etc.

If you need to use AOMEI Partition Assistant on Windows Server, you can AOMEI Partition Assistant Server.

See the detailed steps and learn how to easily recover data lost by Diskpart clean.

Step 1. Find the deleted partition in Disk Management.

Step 2. Run AOMEI Partition Assistant Professional and enjoy it.

Step 3. Click Partition Recovery Wizard on the left panel. Select the disk containing deleted partition and click Next.

Partition Recovery Wizard

Step 4. Select Fast Search. This option takes less time. If you cannot recover the deleted partition for the first time, you can try Partition Recovery Wizard again and select Full Search.

Search Method

Step 5. Select the deleted partition to recover and click Next. To ensure the deleted partition, you can tick the partition and click Explore files in this selected partition to confirm.

Select Lost Partition

Step 6.When you see Congratuations! Click Finish to exit the progress, and you can go to Disk Management or File Explorer to find the lost partition.

Partition Recovery Finish

Wrapping things up

How to recover deleted partition using CMD on Windows 11/10/8/7? This is a common question for computer users. To fix this problem, you can use Diskpart to assign drive letter for it. It is the simplest way. However, you cannot use it if you delete all partition on the disk.

To fix this issue, you can try free AOMEI Partition Assistant. It’s much easier. And it will not cost you a cent. What’s more, it can help you solve many hard drive partition problems, such as, extend volume is disabled, shrink volume greyed out, and more.