Fix a drive that will not format

We'll close programs using the drive, remove write-protection, use diskpart to clean the disk, and format successfully.

Category
Troubleshooting · Home maintenance
Time
10–30 min
Last reviewed
What you'll need
  • Administrator access
  • Backup of any data on the drive (formatting erases everything)

Step-by-step diagnostic

Step 1 of 6
Show full guide

Steps

Goal: Close programs, remove write-protection, and format the drive using diskpart if needed.

  • Close any program that has files open on the drive—File Explorer, backup tools, media players.
  • Good: Format succeeds. Bad: Proceed to Write-protection.

Close programs

Goal: Release the drive so it can be formatted.

  • Close File Explorer windows showing the drive. Close backup tools, cloud sync, media players. Unmount network or virtual drives if applicable.
  • Good: Format works. Bad: Check write-protection.

Write-protection

Goal: Remove physical or logical write-protection.

  • Check for a physical switch on USB drives and SD cards—slide to release (off Lock). If no switch or still protected: Open Command Prompt as Administrator. Run diskpart. Type list disk, select disk X, attributes disk clear readonly, exit.
  • Good: Protection cleared. Try format again. Bad: Proceed to diskpart clean.

diskpart clean

Goal: Use diskpart to clean the disk and format. Erases all data.

  • Open Command Prompt as Administrator. Run diskpart. Type list disk and note the disk number. Type select disk X (replace X). Type clean. Then: create partition primary, format fs=ntfs quick, assign.
  • Good: Drive is formatted with a letter. Bad: If you are formatting the system drive (C:), you cannot do it from Windows—use installation media. For other drives, hardware may have failed.

When to get help

  • You cannot format the system drive from within Windows—boot from installation media and use the installer.
  • If diskpart clean fails, the drive may have hardware issues.
  • For NAS or RAID drives, use the device interface to format—do not use diskpart on array members.

Verification

  • The drive formats without “in use” or “write protected” errors.
  • The drive appears in File Explorer with a letter and shows as empty (or with the new file system).
  • You can create and save files on the drive.

Escalation ladder

Work from the device outward. Stop when the problem is fixed.

  1. Close programs Close File Explorer, backup tools, and any app using the drive.
  2. Write-protection Check physical switch; use diskpart attributes disk clear readonly.
  3. diskpart clean Clean the disk, create partition, format. Erases all data.
  4. Group Policy Check gpedit for removable drive write restrictions.
  5. Pro or installer System drive—use installation media. Hardware issue—contact pro.

What to capture if you need help

Before calling support or posting for help, have these ready. It speeds everything up.

  • Error message when formatting
  • Drive type (USB, internal, SD card)
  • Whether write-protect switch exists and position

Do you see "in use," "access denied," or "cannot format"?

Programs with files open on the drive block formatting.

Close File Explorer windows showing the drive. Close backup tools, media players, cloud sync. Good: Format succeeds. Bad: Still fails—check write-protection.

You can change your answer later.

Do you see "write protected" or "media is write protected"?

Physical switch or diskpart readonly attribute can block format.

Check for physical switch on USB/SD—slide to release (off Lock). If no switch or still protected: open diskpart as Admin, select disk X, attributes disk clear readonly. Good: Protection cleared. Bad: Try diskpart clean.

You can change your answer later.

Have you tried diskpart clean?

Cleaning removes all partitions and often fixes format failures.

Open Command Prompt as Administrator. diskpart > list disk > select disk X > clean > create partition primary > format fs=ntfs quick > assign. Warning: erases all data. Good: Format succeeds. Bad: Drive may have hardware issues—do not format system drive from Windows.

You can change your answer later.

Are you trying to format the system drive (C:)?

You cannot format C: from within Windows.

To format the system drive, boot from Windows installation media (USB or DVD). Use the installer to delete partitions and format during setup. Good: You use installation media. Bad: If not system drive and diskpart failed—drive may have hardware issues.
Question

Is it the system drive?

You can change your answer later.

Format succeeded

The drive is formatted and ready to use.

Use installer or contact pro

System drive: boot from installation media to format. Other drives: if diskpart clean fails, the drive may have hardware issues. For NAS/RAID, use the device interface—do not use diskpart on array members.

Reviewed by Blackbox Atlas

Frequently asked questions

Why would a drive fail to format?
Common causes: the drive is in use by a program, it is write-protected (physical switch or policy), it is the system drive, or the partition is locked. Close programs and check write-protection first.
How do I remove write-protection from a USB drive?
Check for a physical switch on the USB drive or SD card—slide it to the release position (off Lock). If no switch, use diskpart: select disk, attributes disk clear readonly, then clean and create partition.
What is the diskpart clean command?
In diskpart: list disk, select disk X, clean. This removes all partitions and makes the disk blank. Then create partition primary, format fs=ntfs quick. Warning: erases all data on the disk.

Rate this guide

Was this helpful?

Thanks for your feedback.

Continue to