Clean Disk with DiskPart Command

This article will show you how to use DiskPart clean or clean all command to clean a disk in Windows 10/8/7. But if you want to find a simpler way, AOMEI Partition Assistant is a good helper.


By Cherry / Updated on May 12, 2023

Share this: instagram reddit

Why you need to clean disk?

You may want to clean your disk for different reasons.. For example:

  • you may want to clean disk for free up space to store new data.

  • Sometimes, you may want to delete some important files and you do not want it back.

  • Or, you may want to replace the old HDD with an SSD for better performance, and need to sell the old HDD with no data on it. Thus, clean disk is necessary.

no matter why you need to wipe data, clean disk would be useful, and you can use Diskpart with "clean" or "clean all" command. It is better than directly "delete".

How to clean disk with command line?

How to clean disk with Diskpart? Diskpart is a wonderful tool for disk management. You can use it with its specific syntax “clean” or “clean all” to erase the data on the hard drive. To clean disk with Diskpart command line, you can refer to the following steps. Before you do, make sure that you have the correct disk.

  • Click Start, type “cmd”, right click the program and select “Run as Administrator” to open the command prompt. Or you can press the “WIN+R”, type “cmd” and press Enter. Then, you should input “diskpart” to launch the program.

  • Type list disk and press Enter. This would list all the disk of your computer.

  • Then, you can input select disk n to select the disk which you want to clean or clean all on it.

    * If the disk’s status is offline, you can type online disk and press Enter to make it online.

  • Then, type “clean” or “clean all” according to your request.

The clean command will clean the data on the HDD, which is only marked as deleted and written over when the new data is stored at the same place on the HDD. The clean all command will erase every byte on the disk to prevent the deleted data being able to recovered, and it will take a longer time to finish. Here takes an example for you. Clean the disk 1 with the steps above and shown as the following screen shot.

Clean All


  • Here we highly recommend you do not use the clean or clean all command to clean an SSD because that may hurt your SSD and it may slow down the read or write speed of SSD.

  • If you want to wipe data permanently, using Diskpart clean or clean all command is not the first recommended because there are many ways can revert it back by some data recovery software, unless you are already rewrite on it.

To destory data on the disk safely, you can turn to a third-party software AOMEI Partition Assistant for helping you clean disk effectively and effortlessly.

Using AOMEI Partition Assistant to clean disk

If you want to find a simpler way to clean disk without data recovery, here we highly recommend you AOMEI Partition Assistant, a good disk manager which can help you clean disk safely and manage your disk free with the easy-to-use interface. The graphic user interface (GUI) provides you manage disk with a few mouse-clicks. To clean disk, you can use the “Wipe Hard Drive” function.

Before you do, you have to ensure the disk which you want to clean. Because once the disk wiped, the data on the disk would not be able to be recovered.

First, download its free edition, install and launch it. Then you will see the basic situation of your disks. Select the disk which you want to clean, right-click on it, and select Wipe Hard Drive.

Wipe Hard Drive 16gb

Then, you can choose wiping method you like. Here we choose to Fill sectors with zero, which is safe and quick.

Fit Sectors With Zero 16gb

If you would like to choose another three methods- "Fill sectors with random data", "DoD 5220.22-M", "Gutmann", you need upgrade to its Professional edition to unlock the features.

Finally, click Apply -> Proceed to execute the whole operations. (When you click Apply, it will show you the pending operations. Confirm it, then click Proceed to submit the operations).

Proceed 16gb

Wait till the process finish.


Both Diskpart and AOMEI Partition Assistant can clean disk. but the former one needs you to know more about Diskpart, because the command can not be undone once it is executed, and it has risk for data recovery. If you do not want the data be recovered, using AOMEI Partition Assistant is a better chioce. what's more, it is simpler that even a non-technician can operate it alone. By the way, from AOMEI Partition Assistant 5.8 Edition, it provides you partitioning command line too, and if you want to use the command to manage disk, it is also OK. Besides, if you are Windows Server users, you can use AOMEI Partition Assistant Server Edition to do the task.

Cherry · Staff Editor
Cherry is an editor of AOMEI Technology, she covers backup & restore, hard disk & partitions management, cloud files transfer, website & database backup and so on for AOMEI. She enjoys helping people find solutions to their problems. She loves traveling, cooking, reading and so on. She takes most of time with her family when she is not working.