Windows 7 Forums


Windows 7: Disk - Clean and Clean All with Diskpart Command


Disk - Clean and Clean All with Diskpart Command

How to "Clean" or "Clean All" a Disk with the Diskpart Command
Published 03 Jan 2010
Published by

Featured Tutorial

Microsoft Account Display Name - Change
Microsoft Account Display Name - Change

How to Change your Microsoft Account Display Name

Microsoft Account - Sign up for and Create
Microsoft Account - Sign up for and Create

How to Sign up for and Create a Microsoft Account

Microsoft Account "Two-step Verification" - Turn On or Off
Microsoft Account "Two-step Verification" - Turn On or Off

How to Turn "Two-step Verification" On or Off for your Microsoft Account

Microsoft Accounts - Link
Microsoft Accounts - Link

How to Link your Microsoft Accounts

Dual Boot - Windows 7 and Linux
Dual Boot - Windows 7 and Linux

How to Correctly Setup a Dual Boot with Windows 7 and LinuxMint13

Emergency Kit - save your files from a dead OS
Emergency Kit - save your files from a dead OS

How to Create and Use a Linux Mint Mate USB Flash Drive to Recover your Files
How to "Clean" or "Clean All" a Disk with the Diskpart Command

information   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 like it does with the clean all command below. With the clean command, the data on the HDD is only marked as being deleted instead and is only written over when new data is written/saved to the same location on the HDD next.

OR

You could 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 securely delete all data on the disk to help prevent the data from being able to be recovered. "Clean All" takes about an hour per 320 GB to finish running.




Note   Note
  • You cannot use the clean or clean all diskpart commands on a boot disk (ex: disk Windows 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   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. In Windows 7, open an elevated command prompt, or a command prompt at boot.

OR

2. In Windows 8, open an elevated command prompt, or a command prompt at boot.
Note   Note
Be sure that you have the correct Disk #. You would not want to wipe clean the wrong disk.

A) Press the Windows + R keys to open the Run dialog, type compmgmt.msc, and press Enter.

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.
Disk - Clean and Clean All with Diskpart Command-computer_management-1.jpg
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)
Disk - Clean and Clean All with Diskpart Command-online.jpgDisk - Clean and Clean All with Diskpart Command-offline.jpg

3. In the elevated command prompt, type diskpart and press Enter. (see screenshot below)
Disk - Clean and Clean All with Diskpart Command-step1.jpg
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.
Disk - Clean and Clean All with Diskpart Command-step2.jpg
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.
Disk - Clean and Clean All with Diskpart Command-step3.jpg
6. Do either step 7 or 8 below for which command you would like to use.

7. To Use the Clean Diskpart Command
NOTE: See the green INFO box at the top of the tutorial for more information about this command. This command will wipe the HDD quickly.
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 as being like a quick format.
Disk - Clean and Clean All with Diskpart Command-step4_clean.jpg
B) Go to step 9.
8. To Use the Clean All Diskpart Command
NOTE: See the green INFO box at the top of the tutorial for more information about this command. This command will wipe the HDD, and perform a secure erase. "Clean All" takes about an hour per 320 GB to finish running. It's best to only use this command if you wanted to help make sure that the data on the HDD cannot be recovered say when giving or selling the HDD to another person.
A) In the elevated command prompt, type clean all and press Enter. You will see the command prompt below as is until the "clean all" command is finished. (see screenshot below)
NOTE: This will take quite some time (several hours or more) to finish depending on how large the disk is since it is writing over each and every sector on it to zero. Think of it as being like a full or low level format.
Disk - Clean and Clean All with Diskpart Command-step4_clean_all.jpg
B) Continue on to step 9.
9. When finished, in the elevated command prompt, type exit and press Enter. Close the elevated command prompt.

10. The disk will be left as unallocated space. (see screenshot below)
Disk - Clean and Clean All with Diskpart Command-computer_management-2.jpg
11. You will now need to create a new partition or volume on the disk to be able to use it again.
That's it,
Shawn




Need more help? Try searching our extensive help and support site.
Loading
03 Jan 2010   #1
Night Hawk

Windows 7 Ultimate x64, XP Mode, W8 RP VM, Linux Mint Debian 2nd OS HD- 7 Pro x64 second case
New England
 
 

I can remember zero filling drives only 13gb or less using a dos tool and that would take just about the entire day when you mention "full format"!

Nice and simple! This will be a help when going to wipe any flash drive as well.

My System SpecsSystem Spec

05 Mar 2010   #2
Bare Foot Kid

W 7 64-bit Ultimate
The Lowcountry
 
 

Hello Brink.


I just did this on my SSD and at first I thought to make the SSD "Offline" in disk management but in the command window it said that it could not "clean all" on a disk that's "Offline"; you may want to add a mention of this in the tutorial; I'm sorry I didn't think to get you a snip of it, but it should be easy to replicate.

It only took about 15 minutes to do a "clean all" on an 80GB SSD, not bad.




Thank you!
My System SpecsSystem Spec
05 Mar 2010   #3
Bare Foot Kid

W 7 64-bit Ultimate
The Lowcountry
 
 

Here's the snip, I re-did it for you.


Disk - Clean and Clean All with Diskpart Command-disk.jpg
My System SpecsSystem Spec
.


05 Mar 2010   #4
Brink

64-bit Windows 7 Ultimate SP1 & Windows 8 Enterprise
Texas
 
 

Hello Ted,

Ok. I added step 1D to help others avoid this. Thank you for finding this.
My System SpecsSystem Spec
06 Mar 2010   #5
Bare Foot Kid

W 7 64-bit Ultimate
The Lowcountry
 
 

You're welcome Shawn, thank you for all the hard work you put in around here making it easy for the rest of us.
My System SpecsSystem Spec
26 Oct 2010   #6
need4steer

Windows 7 Ultimate 32bit
 
 

Thanks a lot for this great post.
My System SpecsSystem Spec
26 Oct 2010   #7
Brink

64-bit Windows 7 Ultimate SP1 & Windows 8 Enterprise
Texas
 
 

You're most welcome Need4steer, and welcome to Seven Forums.
My System SpecsSystem Spec
07 Nov 2010   #8
zezoclo

Windows 7 Ultimate
 
 
Thanks

Thanks
but unfortunately it doesn't work with me i will give up maintaining my flash drive
My System SpecsSystem Spec
07 Nov 2010   #9
Brink

64-bit Windows 7 Ultimate SP1 & Windows 8 Enterprise
Texas
 
 

Hello Zezoclo, and welcome to Seven Forums.

Could you give us more details on what part did not work for you, and include any error messages or screenshots? We may be able to help to get it to work for you.
My System SpecsSystem Spec
Comment

 Disk - Clean and Clean All with Diskpart Command problems?



Tutorial Tools



Similar help and support threads for: Disk - Clean and Clean All with Diskpart Command
Windows 7 Tutorial Category
Can "diskpart clean all" be performed after a "diskpart clean" ? Hardware & Devices
Solved Diskpart hangs running 'clean all' Installation & Setup
DISKPART & HDD help - Clean All interrupted, disk no longer found. General Discussion
Do not see HDD after clean all using diskpart General Discussion
Solved Diskpart Clean All Error General Discussion


All times are GMT -5. The time now is 03:54 AM.


Seven Forums Android App Seven Forums IOS App Follow us on Facebook

Windows 7 Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32