Disk - Clean and Clean All with Diskpart Command

How to "Clean" or "Clean All" a Disk with the Diskpart Command


   Information
This will show you how to use the clean or clean all 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

  • 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
You do not want to use clean all on a SSD disk often. Having every sector written over to 0 on a SSD can reduce it's life span faster.





Here's How:

1. In Windows 7, open an elevated command prompt, or a command prompt at boot.

OR

2. In Windows 8 and 8.1, open an elevated command prompt, or a command prompt at boot.

   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/tap on Yes.

C) Click/tap 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.
Computer_Management-1.jpg


3. In the elevated command prompt, type diskpart and press Enter. (see screenshot below)
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.
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.
Step3.jpg
6. If the status of the selected disk # (ex: Disk 3) shows as Offline, type online disk, and press Enter to make it online. (see screenshot below)
diskpart_online_disk.png
7. Do either step 8 or 9 below for which command you would like to use.


8. To Use the Clean Diskpart Command
NOTE: (Recommended) 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, press Enter, and go to step 10 below. (see screenshot below)
NOTE: This will not take long to finish. Think of it as being like a quick format.
Step4_Clean.jpg
9. 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, and go to step 10 below. 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.
Step4_Clean_All.jpg
10. When finished, in the elevated command prompt, type exit and press Enter. Close the elevated command prompt.

11. The disk will be left as unallocated space. (see screenshot below)
Computer_Management-2.jpg
12. 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







 
Last edited:
DiskPart is fine. I prefers one that's tried and true.

I've put off formatting that machine and installing Win 7 for months. I think I can face it now. If I turn it into a huge doorstop, and can just put in a different HD.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP p6-2020t
OS
Win 7 Ult 64-bit
CPU
G620 2.6GHZ Pentium R
Memory
6 GB
Monitor(s) Displays
25" HPLV2311
Screen Resolution
1920 x 1200
Hard Drives
1 SATA, 1 exterior SATA
Case
HP
Cooling
PSU
Antivirus
Glasswire
Browser
Waterfox; Firefox; Chrome for work
Other Info
Firewall--Glasswire
Similar specs in Gateway DX4200
Verizon FIOS Wired network

1 other Win7 computer-- has SSD
You went to my original problem and skipped all the replies, then read my most recent question.

Yes, and? I fail to see any logics in that sentence.

Ofc I'll go to your original problem to try and address it. And why not skip all replies in between as there was nothing to say there. I read them and then I read your most recent question and then I gave you a rather reasonable reply. So instead of being thankless try to reason what ppl advise you.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP
OS
Win 7 x64
My uncle is an accountant and wants to wipe his hard drive as to assure a client that his information cannot be recovered by the irs. Clearly a hammer and sulfuric acid would provide nearly absolute assurance, but are there any free or not free software options i can suggest to him?
Thanks.
Joe
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Laptop 17t-by200 CTO
OS
Windows 10 Home C1H1
CPU
2.30 gigahertz Intel Core i7-10510U
Motherboard
HP 865A 64.17
Memory
12GB
Graphics Card(s)
Intel UHD Graphics
Monitor(s) Displays
HP 27es

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Golden,
I read and acted on your reply in early November.
I apologize for taking so long to thank you.
Sincerely,
Joe
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Laptop 17t-by200 CTO
OS
Windows 10 Home C1H1
CPU
2.30 gigahertz Intel Core i7-10510U
Motherboard
HP 865A 64.17
Memory
12GB
Graphics Card(s)
Intel UHD Graphics
Monitor(s) Displays
HP 27es
piramiter error

i did all of the top you showed but i got a error of peramitor i saw in another website that i needed to put a drive leter also which is not here but now i cant to a clean i just did a clean all and it took hours to finish :confused: im worn out i have been trying to clean this HDD for 3 days now i finally got it with DBAN and thru cmd with clean all i added a pic of what it said all went well till i formated it to ntfs quick
 

Attachments

  • 20180503_215218[1].jpg
    20180503_215218[1].jpg
    1.6 MB · Views: 118

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell inspiron N5110
OS
Win 7 64bit Home prem
CPU
Intel i3
Motherboard
Not sure
Memory
6gig
Graphics Card(s)
Intel
Hard Drives
WD 1 TB
Antivirus
None
Browser
None
i dont know why this is upside down.....
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell inspiron N5110
OS
Win 7 64bit Home prem
CPU
Intel i3
Motherboard
Not sure
Memory
6gig
Graphics Card(s)
Intel
Hard Drives
WD 1 TB
Antivirus
None
Browser
None
another error

first i had a paramiter error after fs=ntfs was done now i get this error after i try to clean the drive kinda start over and all
 

Attachments

  • 20180503_224321[1].jpg
    20180503_224321[1].jpg
    1.4 MB · Views: 166

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell inspiron N5110
OS
Win 7 64bit Home prem
CPU
Intel i3
Motherboard
Not sure
Memory
6gig
Graphics Card(s)
Intel
Hard Drives
WD 1 TB
Antivirus
None
Browser
None
it said it was healthy also the drive
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Dell inspiron N5110
OS
Win 7 64bit Home prem
CPU
Intel i3
Motherboard
Not sure
Memory
6gig
Graphics Card(s)
Intel
Hard Drives
WD 1 TB
Antivirus
None
Browser
None
Hello UnKnown4mat, and welcome to Seven Forums. :)

What type of drive are your trying to run the clean command on?

Usually this error is an indication of drive failure.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self built custom
OS
64-bit Windows 11 Pro for Workstations
CPU
Intel i7-8700K OC'd to 5 GHz
Motherboard
ASUS ROG Maximus XI Formula Z390
Memory
64 GB (4x16GB) G.SKILL TridentZ RGB DDR4 3600 MHz
Graphics Card(s)
ASUS ROG-STRIX-GTX1080TI-O11G-GAMING
Sound Card
Integrated
Monitor(s) Displays
2 x Samsung Odyssey G7 27"
Screen Resolution
2560x1440
Hard Drives
1TB Samsung 990 PRO M.2,
4TB Samsung 990 PRO PRO M.2,
TerraMaster F8 SSD Plus NAS
PSU
Seasonic Prime Titanium 850W
Case
Thermaltake Core P3
Cooling
Corsair Hydro H115i
Keyboard
Logitech wireless K800
Mouse
Logitech MX Master 4
Internet Speed
2 Gb/s Download and 100 Mb/s Upload
Antivirus
Malwarebyte Anti-Malware Premium
Browser
Google Chrome
Other Info
Logitech Z625 speaker system,
Logitech BRIO 4K Pro webcam,
HP Color LaserJet Pro MFP M477fdn,
APC SMART-UPS RT 1000 XL - SURT1000XLI,
Galaxy S23 Plus phone
Back
Top