How to format USB with DiskPart
Published: Oct 20, 2024
Last updated: Jan 27, 2025
Introduction
This tutorial is deigned to guide you through formatting a USB with DiskPart (Disk Partition command interpreter) via CMD (Command Prompt/Windows command line interface). Since this is through CLI, you'll look and feel extra cool!
You will need a USB flash drive. For this tutorial I used a
SanDisk Ultra USB 3.0 Flash Drive, which can be found on Amazon.*
If you have ever flashed a disk using balenaEtcher, then you've probably run into this scenario before.

You flash a disk, use it to install an OS or whatever, then your USB is no longer recognized and/or accessible by Windows. Happens to me all the time... You may receive one (or all) of the following errors.

If you've seen any of the above errors, oof. Luckily, there's a way to fix this issue that's pretty quick, easy, and feels cool.
DiskPart
To get started, open CMD with admin priviliges. Enter the following commands (non-case sensitive):
DiskPart or
DiskPart.exe
list disk
sel disk n (where n = disk number)
clean
create partition primary
sel partition 1
format quick
Additional notes:
DiskPart and
DiskPart.exe are interchangeable.
Sel and
select are interchangeable.
Sel is shorter so why not?
The error messages referenced above are not exclusive to balenaEtcher; however, I personally experience them most frequently while flashing disks with the app.
For reference, this is what the full series of commands looks like:
* Amazon Associate notice! *
As an Amazon Associate I earn from qualifying purchases.
For this tutorial I used a
SanDisk Ultra USB 3.0 Flash Drive, which can be found on Amazon.
References:
W3Schools
Random post on
stack overflow
Mozilla Developer Network documentation. Shoutout to
u/morewordsfastera on Reddit.