diskpart utility in the command prompt during setup to clean the disk and recreate the partition structure from scratch, ensuring the BIOS/UEFI firmware can correctly locate the new Windows installation target.
Understanding the Partition Error Context
When you attempt to install Windows 10, the setup process requires a contiguous block of unallocated space. If you receive an error stating that it could not create a new partition or locate an existing one, it usually means the disk's partition table is in a state the installer does not recognize as "clean." This frequently happens on drives that previously housed another operating system, particularly if they used a GUID Partition Table (GPT) scheme with specific boot partitions.
The Windows Installer checks for specific partition attributes. If there are hidden partitions, such as the Recovery Partition or the EFI System Partition, that have incorrect flags or are marked as active when they shouldn't be, the installer may fail to proceed. Additionally, if the disk contains mixed MBR and GPT structures, or if the disk has been partially converted without proper cleanup, the installer will reject the drive to prevent data loss or boot failures.
Preliminary Checks Before Wiping Data
Before proceeding with a full disk wipe, which erases all data, ensure that your installation media is up to date. Sometimes, older versions of the Windows 10 installer have bugs related to large hard drives or specific USB controller drivers. You should also verify that your computer is booting from the USB drive in the correct mode: UEFI for GPT disks and Legacy BIOS for MBR disks. Mixing these modes can cause the installer to misinterpret the partition layout.
If you have critical data on the drive, consider backing it up first. However, if the drive is already failing or you are reinstalling on a secondary drive, you can proceed directly to the solution below. For users who accidentally deleted their EFI and MSR partitions, recovering those structures might be necessary if you intend to keep the current OS, but for a fresh Windows 10 install, removing them is part of the standard procedure.
Solution 1: Using DISKPART to Clean the Disk
This is the most effective method for resolving partition errors during Windows 10 installation. It forces the removal of all existing partition structures, allowing the installer to create a fresh, compatible layout. Follow these steps carefully:
- Boot from your Windows 10 installation USB drive.
- On the screen asking "Which type of installation do you want?", select Custom: Install Windows only (advanced).
- You will see a list of drives and partitions. Instead of clicking next, press
Shift + F10to open the Command Prompt. - Type
diskpartand press Enter to launch the diskpart utility. - Type
list diskand press Enter. Identify your target disk by its size (e.g., Disk 0). - Type
select disk X(replace X with your disk number) and press Enter. - Type
cleanand press Enter. This removes all partitions and volumes from the selected disk. - Type
convert gpt(for UEFI systems) orconvert mbr(for Legacy BIOS) and press Enter. - Type
exittwice to close diskpart and the Command Prompt. - Click the Refresh button in the installer window, then select the now-Unallocated Space and click Next.
This process ensures that the disk is completely free of conflicting partition tables. If you encounter issues with specific partition attributes after cleaning, you can refer to guides on changing partition attributes using DISKPART for more granular control, though a simple clean operation usually suffices for fresh installs.
Solution 2: Deleting Existing Partitions Manually
If you prefer not to use the command line or if the clean command fails due to hardware restrictions, you can manually delete partitions through the GUI installer. In the same installation window where you see the drive list:
- Select each partition on the target drive one by one.
- Click Delete for each partition until only "Unallocated Space" remains.
- Be cautious not to delete partitions on other drives if multiple disks are present.
- Once only unallocated space is visible, select it and click Next.
This method achieves the same result as the clean command but allows you to visually confirm which data is being removed. It is less aggressive than wiping the entire disk sector-by-sector but effectively resolves the "cannot locate existing partition" error by presenting a blank slate to the installer.
Solution 3: Addressing GPT/MBR Conversion Issues
Sometimes, the error persists because the disk was previously split into two parts due to a failed conversion between GPT and MBR formats. If your C drive appears split into two separate partitions in the device manager, this fragmentation can confuse the installer. In such cases, you must ensure the disk is unified before installation. Refer to articles discussing GPT/MBR conversion issues to understand how to merge these partitions safely before attempting the Windows 10 setup again.
Frequently Asked Questions
Will cleaning the disk delete my files?
Yes, the clean command in diskpart permanently deletes all partitions and data on the selected disk. Ensure you have backed up any important files before proceeding. This action is irreversible within the Windows installer environment.
Why does the installer say "Windows cannot be installed to this disk"?
This error usually indicates a mismatch between the boot mode (UEFI vs. Legacy) and the disk style (GPT vs. MBR). If you are booting in UEFI mode, the disk must be GPT. If you are booting in Legacy mode, the disk must be MBR. Use the convert gpt or convert mbr commands in diskpart to align the disk style with your boot mode.
Can I fix this error without losing data?
If you need to preserve data, you cannot use the clean command. Instead, try deleting individual non-essential partitions in the installer GUI or use third-party partition management tools in Windows PE to shrink or move partitions. However, for a clean Windows 10 install, wiping the disk is the recommended approach to avoid boot conflicts.
What if diskpart shows "Access Denied"?
This can happen if the disk is write-protected or if a background service is locking the volume. Ensure no other processes are accessing the disk. If using a USB external drive, check for a physical write-protection switch. In some cases, restarting the computer and retrying the diskpart commands immediately upon reaching the installation screen resolves the lock.
Is it safe to convert MBR to GPT during installation?
It is safe provided you have backed up your data, as the conversion process itself involves rewriting the partition table. The convert gpt command in diskpart is designed to handle this transition cleanly. However, if the disk has complex partition layouts, manual deletion of partitions before conversion is safer to prevent corruption.