sodcalculator

10 Tech How-To

Fix Windows Could Not Format a Partition on Disk

Guide 10-21668 · Updated · Step by step

If Windows shows “Windows could not format a partition on disk” during installation or when using Disk Management, the fix is usually to clean the disk with DiskPart, remove any lingering partition structures, or repair the disk’s file system. This error typically appears because the partition table is corrupted, the disk has leftover protection flags, or the drive contains system recovery partitions that Windows refuses to modify. Below is a step-by-step guide to resolve it, along with the background and related details you need to understand why it happens.

What Causes This Error

The message “Windows could not format a partition on disk” is most common during a clean Windows installation, but it can also appear in Disk Management when you try to format a USB drive, SD card, or internal hard drive. The underlying causes fall into a few categories:

  • Corrupted partition table – The Master Boot Record (MBR) or GUID Partition Table (GPT) has invalid entries that Windows cannot interpret.
  • Active system or recovery partitions – Windows protects partitions that contain boot files or recovery tools; it will refuse to format them through the normal GUI.
  • Disk write protection – Some drives, especially USB sticks, have a physical lock switch or a software flag that blocks all writes, including formatting.
  • File system errors – The partition has logical errors that prevent the format operation from completing.
  • Driver or controller issues – In rare cases, a faulty storage driver or an incompatible RAID controller causes the format to fail.

Understanding the cause helps you choose the right fix, but in most cases, you can resolve the error by removing all partitions on the disk and starting fresh.

Before You Begin: Back Up and Identify the Disk

Formatting a partition erases all data on that partition. If the disk contains files you need, back them up before proceeding. Also, make absolutely sure you are working on the correct disk. In Disk Management, disks are numbered (Disk 0, Disk 1, etc.). In DiskPart, you can list disks and see their sizes. A common mistake is selecting the wrong disk and wiping the system drive or an external backup drive.

To identify a disk safely, check its size and model. For example, if you have a 500 GB internal drive and a 32 GB USB stick, the 32 GB device is almost certainly the USB. If you are unsure, disconnect all other storage devices except the one you need to fix.

Method 1: Use DiskPart to Clean the Disk

DiskPart is a command-line tool built into Windows that can remove all partition information and reset the disk to a clean state. This is the most reliable fix for the “could not format” error because it bypasses the GUI protections.

  1. Open Command Prompt as administrator. Press Windows Key + X and select “Command Prompt (Admin)” or “Windows PowerShell (Admin)”.
  2. Type diskpart and press Enter.
  3. Type list disk and press Enter. Note the disk number of the drive you want to fix.
  4. Type select disk X (replace X with the correct number) and press Enter.
  5. Type clean and press Enter. This removes all partitions and the partition table from the selected disk.
  6. Type exit and press Enter to close DiskPart.

After cleaning, the disk will appear as “Unallocated” in Disk Management. You can now create a new partition and format it normally. If you are installing Windows, you can proceed with the installation and create a partition on the unallocated space.

Method 2: Remove Hidden Partitions in the Windows Setup

If the error occurs during Windows installation, you might see the message when you try to format a partition that Windows Setup identifies as a system partition. Windows Setup often hides certain partitions (like the EFI system partition or the MSR partition) but still shows them in the list. To fix this, you need to delete all partitions on the target disk and let Windows create new ones.

  1. Boot from the Windows installation media (USB or DVD).
  2. When you reach the “Where do you want to install Windows?” screen, press Shift + F10 to open Command Prompt.
  3. Run diskpart and then list disk.
  4. Select the correct disk with select disk X.
  5. Type clean to remove all partitions.
  6. Close Command Prompt and click “Refresh” in the setup window.
  7. Now click “New” to create a partition on the unallocated space, or simply select the unallocated space and click “Next”. Windows will create the necessary partitions automatically.

Method 3: Check for Write Protection and File System Errors

If DiskPart’s clean command fails with an error like “DiskPart has encountered an error: Access is denied,” the disk may be write-protected. For USB drives, check for a physical lock switch on the side of the drive. If there is no switch, you can try removing the read-only attribute with DiskPart:

  1. Open DiskPart as administrator.
  2. Type list disk, then select disk X.
  3. Type attributes disk clear readonly and press Enter.

For file system errors, you can run chkdsk on the partition before formatting. In Command Prompt, type chkdsk X: /f (replace X with the drive letter). This will attempt to fix logical errors that might be blocking the format.

Method 4: Use Third-Party Partition Tools

If the built-in tools still fail, a third-party partition manager can often force a format. Many of these tools offer a “low-level format” or “wipe” option that completely overwrites the disk. However, be cautious: low-level formatting can take hours on large drives and is not necessary for most cases. A simple “delete all partitions” and “format” in a third-party tool often works when Windows refuses. Some popular free tools include GParted (Linux-based, can be booted from USB) and the free versions of commercial partition software. Always download tools from official sources to avoid malware.

Frequently Asked Questions

Will cleaning the disk erase all my data?

Yes, the clean command removes all partitions and the data on them. It does not securely erase the data (it only removes the partition table), so recovery software might still recover files, but the disk will appear empty and unallocated.

Can I fix this error without losing data?

If the error is caused by file system corruption, running chkdsk might fix it without formatting. If the partition table is corrupted, you might be able to use a recovery tool to rebuild it, but this is complex and not guaranteed. In most cases, you will need to format, which erases data.

Why does Windows say “format” but then fail without any error code?

This often happens when the disk has a hidden system partition that Windows is trying to protect. The GUI may not show a detailed error. Using DiskPart to clean the disk removes the protection and allows a fresh format.

Is it safe to use DiskPart on my system drive?

Only if you intend to wipe the system drive and reinstall Windows. If you select the wrong disk, you will lose all data on it. Double-check the disk number before running clean.

What if the disk is an SSD and the error persists?

Some SSDs have a firmware bug that causes format failures. Try updating the SSD firmware from the manufacturer’s website. Also, ensure the SSD is connected properly (SATA cable or M.2 slot) and that the system BIOS recognizes it correctly.

Can I use a Mac to format the disk and then use it on Windows?

Yes, you can format a disk on a Mac using Disk Utility, but choose the file system that Windows can read, such as exFAT or FAT32. If you format as APFS or HFS+, Windows will not recognize it without third-party software.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →