How to Clean all Disk's with the Diskpart Command





Information
This will show you how to use the clean command on a selected disk to delete all of it's MBR or GPT partitions, volumes, and any hidden sector information on MBR disks is overwritten. The data on the HDD is not written over using the clean command. It is only marked as being deleted and can be written over when new data is written/saved to the HDD next.



OR

You can use the clean all command (secure erase) to do the above and also have each and every disk sector on the HDD written over and zeroed out completely to sanatize and delete all data on the disk. This option takes longer to do, but is the best option to help ensure that the data on the disk has been removed and not just marked as deleted.

This article is applicable to Windows 7, Windows Vista and Windows Xp as well.



Note
You cannot use the clean or clean all diskpart commands on a boot disk (ex: disk Windows 7 is installed on) unless you do it from a command prompt at boot.
Be sure to backup anything that you do not want to lose on the disk that you use clean or clean all on first. It will be to late afterwards. All data will be permanently lost on the disk.

Warning
You do not want to use clean all on a SSD disk often. Having every sector written over to 0 on a SSD can help reduce it's life span.

Here's How:
1. To Verify the Disk Number to Clean or Clean All

Warning
Be sure that you have the correct Disk #. You would not want to wipe clean the wrong disk.

A) Open the Start Menu, then right click on Computer and click on Manage.

B) If prompted by UAC, click on Yes.

C) Click on Disk Management in the left pane, and make note of the disk # in the middle pane of the disk that you want to clean or clean all. (see screenshot below)

NOTE:
For example, I would use Disk 1 if I wanted to use clean or clean all on my USB key drive.


D) Look under the Disk # (ex: Disk 3) in the left part of the middle pane, and check to make sure it says Online. If it doesn't, then right click on Disk # and click on Online to make it so. (see screenshots below)




2. Open a elevated command prompt, or a command prompt at boot.

3. In the elevated command prompt, type diskpart and press Enter. (see screenshot below)



4. In the elevated command prompt, type list disk and press Enter. (see screenshot below)
NOTE:
This will give you a list of disk numbers to select from.



5. In the elevated command prompt, type select disk # and press Enter. (see screenshot below)
NOTE:
You would substitute # for the disk number listed that you want to use clean or clean all on. For example, I want to use one of them on Disk 1 (from step 1) for my USB key drive, so I would type select disk 1 and press Enter.



6. To Use the "Clean" Diskpart Command -

A) In the elevated command prompt, type clean and press Enter. (see screenshot below)

NOTE: This will not take long to finish. Think of it being like a quick format.



B) Go to step 8.

7. To Use the "Clean All" Diskpart Command -

A) In the elevated command prompt, type clean all and press Enter. (see screenshot below)

NOTE:
This could take quite some time to finish depending on how large the disk is since it writing over each and every sector on it to zero. Think of it being like a full or low level format.



8. When finished, in the elevated command prompt, type exit and press Enter. Close the elevated command prompt.

9. The disk will be left as unallocated space. (see screenshot below)



10. You will now need to create a new partition or volume on the disk to be able to use it again.

This article is applicable to Windows 7, Windows Vista and Windows Xp as well.