0X000010D7

Fix ERROR_UNABLE_TO_CLEAN (0X000010D7) on Windows

That 0X000010D7 error usually means your drive doesn't support a clean command or the filesystem is locked. Here's how to get past it.

You ran clean in DiskPart, and instead of wiping the drive you got smacked with ERROR_UNABLE_TO_CLEAN (0X000010D7). Annoying, especially when you're trying to prep a USB stick or a spare SSD for a fresh install. This error almost always means one of three things: the drive is write-protected, the filesystem is locked by something Windows is holding onto, or the drive genuinely can't handle a clean command (yes, some cheap flash drives and SD cards are like that).

Let's work through them in order of how often they actually show up.

1. The drive is write-protected (most common)

This is the culprit about 60% of the time. You'd think write protection only applies to SD cards with the little plastic tab flipped, but it also gets set at the firmware and OS level. USB sticks from SanDisk, Kingston, and a bunch of generics ship with a write-protect bit that gets toggled if the drive detects too many bad sectors. It's a self-preservation mode. The drive is effectively saying "I'm dying, stop writing to me."

Open an elevated Command Prompt (right-click Start, Terminal as Admin on Win11, or CMD as Admin on Win10), then run:

diskpart
list disk
select disk X   (replace X with your drive number)
attributes disk

Look at the output. If you see Current Read-only State : Yes, that's your problem. Try clearing it:

attributes disk clear readonly
clean

If the read-only state flips back to Yes immediately, the write protection is baked into the drive controller. There's no software fix for that. The drive is toast. I've seen this most on cheap MicroSD cards and no-name USB drives from Amazon marketplace sellers.

For SD cards specifically, check the physical lock switch on the side. Yeah, it sounds obvious, but I can't tell you how many support tickets I've closed with "flip the tab back."

2. A process is holding the volume open

If the drive isn't read-only but DiskPart still refuses to clean it, something has a handle on it. Common culprits: Windows Search indexing, antivirus real-time scanning, a stuck Explorer window, or—and this one gets missed constantly—the page file or system restore sitting on the drive.

Kill the obvious stuff first. Close every Explorer window, unplug any other USB drives, and pause your antivirus temporarily. Then in DiskPart, before you run clean, do this:

select disk X
online disk noerr
detail disk

Check the status. If it says Read-only or Offline, that's the blocker. Try:

attributes disk clear readonly
online disk
clean

Still failing? Boot into Safe Mode. It's a pain, but it strips out every third-party service that might be holding the drive. Hold Shift while clicking Restart, then Troubleshoot → Advanced Options → Startup Settings → Restart → press 4. Run DiskPart there. If clean works in Safe Mode but not normally, you've got a background service to hunt down. Process Explorer (from Sysinternals) with Ctrl+F for the drive letter will find the handle in seconds.

3. The drive doesn't support the clean command

This is the one people don't expect. Some drives—particularly older USB 2.0 flash sticks, certain SD cards, and a handful of external enclosures running odd USB-to-SATA bridge chips—report a disk type that DiskPart can't issue a clean against. Usually it's because the enclosure's controller doesn't pass through ATA Secure Erase or the drive identifies as removable media rather than a fixed disk.

You'll see this if list disk shows the drive but detail disk reveals it as Removable or the size is reported as 0 bytes. Also happens with some WD and Seagate external drives when the USB bridge is the older JMS578 or ASMedia 1153E chip.

Two options here:

  1. Pull the drive out of the enclosure. If it's a SATA drive inside a USB shell, yank it and connect it directly to a SATA port or a different enclosure with a known-good bridge chip (JMicron JMS583 or ASMedia ASM2362 work reliably). Then run clean again. This fixes it more often than any software trick.
  2. Use the manufacturer's tool. Samsung Magician for Samsung SSDs, WD Dashboard for Western Digital, SanDisk SSD Dashboard. These tools can issue secure erase commands that bypass whatever DiskPart is tripping on.

If it's a genuine generic USB stick with no brand, there's usually no recovery path. The controller is too dumb to accept a clean and too locked down to flash. Replace it.

One more thing to check before you give up

Run clean all instead of just clean. Yes, it takes way longer—it writes zeros to every sector—but it also forces the drive controller to acknowledge each write. On marginal drives, this can push past the ERROR_UNABLE_TO_CLEAN error where a plain clean fails. Expect 20 to 45 minutes for a 500GB drive. Don't interrupt it.

diskpart
list disk
select disk X
clean all

If that still throws 0X000010D7, the drive is either actively failing or permanently write-protected. Check the SMART data with CrystalDiskInfo. Reallocated sector count above 100 or a status of "Caution" or "Bad" means it's time to retire the drive.

Quick reference

CauseQuick checkFix
Write protectionattributes disk shows Read-only: Yesattributes disk clear readonly then clean
Volume locked by processDisk status shows Offline or busySafe Mode + online disk + clean, or kill the handle with Process Explorer
Drive doesn't support cleandetail disk shows Removable or 0 byte sizePull from enclosure, or use vendor tool (Samsung Magician, WD Dashboard)
Marginal drive firmwarePlain clean fails but SMART is OKclean all (slow, but forces write acknowledgment)
Dying driveRead-only flips back after clearingReplace the drive. No software fix exists.

If you've worked through all four and it still won't clean, the drive is done. Don't spend another hour on it. CrystalDiskInfo will confirm it in 10 seconds.

Related Errors in Hardware – Hard Drives
0X000002C1 ERROR_FT_WRITE_RECOVERY 0x000002C1: Fix a Fault-Tolerant Volume Write Failure Invalid Class Name Fix 'Invalid Class Name' Hard Drive Error in Windows Drive Shows as RAW – Fix Without Losing Data WD Click of Death: Fix and Recovery Steps

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.