What Does Diskpart Clean Do vs. Clean All?

The diskpart clean command removes all partition and volume information from a disk, but it does not erase the actual data stored on it. It wipes the disk’s structural metadata, essentially deleting the “table of contents” that tells your computer where files are and how the drive is organized. The command takes only a few seconds to run, and afterward the disk appears completely empty and unallocated in Windows.

What Clean Actually Removes

Every disk has a small amount of data at the beginning that defines its partitions, file system type, and volume layout. The clean command targets only this structural information. Think of it like ripping the index out of a book: the pages are all still there, but nothing tells you which chapter starts where.

After running clean, Windows treats the disk as brand new. It won’t show up in File Explorer, and any partitions you previously created (including recovery partitions or EFI system partitions) are gone from the operating system’s perspective. You’ll need to initialize the disk, create new partitions, and format them before you can use the drive again.

Because the underlying data sectors are left untouched, files can often be recovered using specialized recovery software like Recuva, as long as nothing new has been written to the drive since the clean command was run. This is an important distinction: clean makes data inaccessible, not destroyed.

Clean vs. Clean All

Diskpart offers a second variant, clean all, that works very differently under the hood. While clean only removes partition metadata, clean all writes zeros to every single sector on the disk. This overwrites all stored data and makes recovery effectively impossible.

The tradeoff is time. The standard clean command finishes in seconds. Clean all takes roughly 3.5 hours per terabyte of storage. A 6 TB hard drive can take 16 to 21 hours depending on your connection speed, with faster SATA interfaces completing the job more quickly than older or external USB connections. If you’re wiping a drive before selling or donating it, clean all is the appropriate choice. If you’re just restructuring a drive you plan to keep, the standard clean command is sufficient.

When You’d Use the Clean Command

The most common scenario is preparing a disk for a fresh start. If you need to convert a drive from MBR to GPT partitioning (or vice versa), Windows won’t let you do it while existing partitions are present. Running clean wipes the partition table so you can reinitialize the disk in the format you need.

It’s also useful when a drive has become corrupted or has a partition layout that normal formatting tools can’t fix. USB drives that were used to create bootable installation media sometimes end up with unusual partition schemes that Windows Disk Management won’t touch. Clean resets the drive to a blank state so you can start over. The same applies to drives that show the wrong capacity or have hidden partitions you can’t delete through the graphical interface.

How to Run It Safely

Diskpart requires administrator privileges. Right-click Command Prompt (or Windows Terminal) and select “Run as administrator,” then type diskpart to enter the tool. The critical safety step is making absolutely sure you’ve selected the right disk, since clean is irreversible on the targeted drive.

The standard workflow looks like this:

  • list disk displays all connected disks with their sizes, which helps you identify the correct one
  • select disk X (replacing X with the number of your target disk) sets the focus
  • clean executes the command on the selected disk

Double-check the disk number against the size shown. If you have a 256 GB system drive and a 1 TB secondary drive, the size column is the easiest way to confirm you’re targeting the right one. Running clean on your Windows installation drive will make your system unbootable.

SSD Considerations

The standard clean command works fine on SSDs and doesn’t cause meaningful wear. Clean all is a different story. SSDs have a limited number of write cycles, and writing zeros to every sector counts against that lifespan. Running clean all on an SSD once or twice won’t destroy the drive, but it’s not recommended as a routine practice. If you need to securely erase an SSD, many manufacturers offer dedicated tools that use the drive’s built-in secure erase function, which is faster and easier on the hardware.

Fixing “Access Is Denied” Errors

If diskpart throws an access denied error when you try to clean a disk, the most common cause is write protection. Some drives have a physical write-protect switch, but more often the protection is set at the software level. You can clear it within diskpart itself by selecting the disk and running attributes disk clear readonly before attempting clean again.

If that doesn’t work, the write protection may be set in the Windows registry. The relevant key is located at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If a value called WriteProtect exists there, changing it to 0 removes the restriction. If the StorageDevicePolicies key doesn’t exist at all, write protection isn’t coming from the registry, and the issue likely lies with the drive’s firmware or a physical lock.