How to Create Bootable USB Using DiskPart
In this article
Yes, you can create a bootable USB drive using DiskPart in Windows. This built-in command-line tool allows you to prepare a USB flash drive for installing or repairing an operating system by formatting and configuring it correctly. The process involves selecting the drive, cleaning it, creating a new partition, formatting it, and marking it as active. All steps are performed in Command Prompt with administrative privileges.
What You'll Need
- A USB flash drive (minimum 8 GB recommended)
- A Windows PC with administrative access
- A Windows installation ISO file (or other bootable image)
- Internet connection (optional, for downloading ISO if needed)
Step-by-Step
- Insert the USB drive into an available USB port on your computer. Ensure it’s empty, as all data will be erased during this process.
- Press Windows + X and select Command Prompt (Admin) or Windows Terminal (Admin) from the menu. If prompted by User Account Control, click Yes to continue.
- In the Command Prompt window, type
diskpartand press Enter. Wait for the DiskPart utility to initialize. - Type
list diskand press Enter. This displays all storage devices connected to your PC. Identify your USB drive by its size. Be very careful to select the correct disk to avoid erasing the wrong drive. - Type
select disk X(replace X with the number corresponding to your USB drive) and press Enter. For example, if your USB is Disk 1, typeselect disk 1. - Type
cleanand press Enter. This removes all partitions and data from the selected disk. The process may take a few seconds. - Type
create partition primaryand press Enter. This creates a single primary partition on the USB drive. - Type
select partition 1and press Enter. This ensures the newly created partition is selected for formatting. - Type
format fs=ntfs quickand press Enter. This formats the partition using the NTFS file system. Usefs=fat32instead if the target system requires FAT32 (e.g., older UEFI systems). - Type
activeand press Enter. This marks the partition as bootable, allowing the system to recognize it during startup. - Type
assignand press Enter. This assigns a drive letter to the USB so it appears in File Explorer. - Type
exittwice to close DiskPart and then close the Command Prompt window. - Mount the Windows ISO file by double-clicking it in File Explorer, or use third-party software to extract its contents. Copy all files from the mounted ISO to the USB drive. Wait for the copy process to complete.
Common Mistakes
- Selecting the wrong disk: Entering
select diskwith the wrong number can erase your hard drive or SSD. Always double-check the disk size in thelist diskoutput. - Skipping the 'active' command: Without marking the partition as active, the system may not boot from the USB even if files are copied correctly.
- Using slow or corrupted USB drives: Low-quality or failing drives may not boot properly or fail during OS installation.
- Incorrect file system: Using exFAT or not formatting at all can prevent booting on some systems. NTFS is standard for Windows ISOs.
- Not copying all ISO files: Simply formatting isn't enough. The boot files from the ISO must be fully copied to the USB.
Tips
- Use a USB 3.0 drive for faster read/write speeds during installation.
- Keep the USB drive dedicated to bootable tasks to avoid accidental data loss.
- After formatting, verify the drive letter assigned and ensure it matches the one used when copying files.
- If copying files fails, try using
robocopyin Command Prompt for more reliable transfers. - Some systems require legacy BIOS mode or CSM enabled in UEFI settings to boot from USB.
Troubleshooting
If the USB does not boot, first confirm it appears in the boot menu (usually accessed via F12, F10, or Esc during startup). If not, recheck that the active command was used. If the drive shows up but displays an error like 'No bootable device', ensure all files from the ISO were copied correctly. Try remounting the ISO and copying again. If DiskPart does not recognize the USB, try a different port or restart the PC with the drive inserted. If the clean command fails, the drive may be locked or write-protected—check for a physical switch or use diskpart to attributes disk clear readonly before cleaning. If the system boots but hangs, verify the ISO file is not corrupted by checking its hash if available.
Frequently Asked Questions
Can I use DiskPart on Windows 10 and 11?
Yes, DiskPart is available and works the same way in both Windows 10 and 11.
Do I need to download additional software?
No, DiskPart is built into Windows. You only need the ISO file and a USB drive.
Why does my PC not detect the bootable USB?
Your BIOS/UEFI may not have USB boot enabled. Enter firmware settings and ensure USB or removable devices are in the boot order.
Can I create a bootable USB for Linux using DiskPart?
DiskPart can prepare the drive, but copying Linux ISO contents requires additional tools like Rufus, as standard file copy may not make it bootable.
What size USB drive do I need?
At least 8 GB for most Windows ISOs. Larger drives (16 GB) are safer for future use.
Does this method work for repairing Windows?
Yes, a bootable USB created this way can be used to repair, reset, or reinstall Windows.