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.
What you'll need
- Administrator access
- Backup of any data on the drive (formatting erases everything)
Step-by-step diagnostic
Quick triage — pick your path
Quick triage — pick your path
Choose the option that matches what you see. You can jump straight to that section.
- "In use" or "access denied" Format fails because the drive is in use.
- Write-protected You see "media is write protected" or "disk is write protected."
- Use diskpart Disk Management or Format fails and you have backed up data.
- Follow full steps Work through the full procedure from closing programs to diskpart.
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.
- Close programs Close File Explorer, backup tools, and any app using the drive.
- Write-protection Check physical switch; use diskpart attributes disk clear readonly.
- diskpart clean Clean the disk, create partition, format. Erases all data.
- Group Policy Check gpedit for removable drive write restrictions.
- 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.
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.
You can change your answer later.
Have you tried diskpart clean?
Cleaning removes all partitions and often fixes format failures.
You can change your answer later.
Are you trying to format the system drive (C:)?
You cannot format C: from within Windows.
Is it the system drive?
You can change your answer later.
Format succeeded
Use installer or contact pro
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.