Command to wipe a hard drive

by William / Thu Sep 06 2018

We can use those commands in diskpart to wipe a hard drive clean before you reinstall the system or giveaway the hard drive

Clean and Clean all commands

press Win+R and type diskpart and press Enter and then in the command window type ? (question mark) to see the explanation of each command, in which the ‘clean’ command defines as:

CLEAN - Clear the configuration information, or all information, off the disk.

As it indicates, it clear the config info off the disk, not the actual data (personal stuff, i.e.), so data on disks wiped from this command can be recovered

But the clean all command is not listed in the help intro, that’s probably why some guides not sharing this command. Anyway, let’s get started

The “clean all” command, however, will remove everything (config info and data) from the disk, so nothing can be recovered after this command, but this step will take longer, and even longer especially when the hard drive capacity is large

Diskpart clean

In the diskpart window, type the commands below:

  • list disk
  • select disk x*
  • clean

like this screenshot:

The ‘CLEAN’ command takes 1-pass 0-overwrite on config intro sectors, the speed is fast

diskpart clean

Diskpart clean all

To thoroughly wipe the entire disk, use the ‘clean all’ command:

  • list disk
  • select disk x*
  • clean all

like the screenshot below:

diskpart clean all

*: “x” is the disk you’re about to wipe, Then it will show the result

Both operations will trigger the initialize window if you run Disk Management and keep the cleaned disk plugged in. (Just ask you to create a GPT or MBR disk)

If the hard drive you’re about to wipe has Windows installed, you have to use this command from BIOS. Insert the Windows bootable media, click the recovery disc and click the “Command Prompt” to run diskpart and clean

command prompt before windows
System Recovery Options: Command Prompt

Wipe Free Space

Besides the clean and clean all commands to clean the entire disk in diskpart, we can use another built-in command tool called Cipher.exe to wipe free space if you have already performed the Delete operation on the disk

Steps to wipe free space using Cipher

  1. Delete all the files and folders on each partition or just format each partition
  2. Press Win+R and type cmd
  3. Type cipher /w:c:

To wipe free space on C Drive, replace it with another drive letter on the disk to wipe them individually

You may have found the shortages or doing this:

  1. not all files and folders in C Drive or the system volume can be deleted and if we force delete them, an error will show, nor can we format that volume
  2. when there are many partitions on the disk, this method is not efficient
  3. this command is slow because it uses 3-pass overwrite method

OK, that’s all for it, the commands methods to wipe hard drive end here, but if you’d like a tool with a graphical interface, you can try Data Wiper

Command wipe hard drive alternative: Data Wiper

Macrorit Data Wiper enables us to:

  • Wipe Recycle Bin
  • Wipe Free Space
  • Wipe Entire Partition
  • Wipe Entire Disk

What’s more important, you can even wipe Windows even when it’s running, so to wipe hard drive in Data Wiper (no matter it has Windows or not), we click on the Wipe Entire Disk option and choose 1 wiping plan (from the listed 6) and click on the disk to wipe

wipe entire disk in Data Wiper
Data Wiper wipe entire disk option

Portable Data Wiper Download