User Tools

Site Tools


windows:diskpart_cleanusb

Diskpart clean USB drive

Sometimes I use USB to install non-windows stuff and then I may write image directly to USB with Etcher tool etc. These images may contain multiple partitions and returning USB back to single volume fat drive can be tricky. Windows has inbuilt tool called diskpart which usually can be used to clean USB disk and recover it back to single partition mode.

Open Command Prompt/Powershell as admin, run command diskpart (do not insert USB yet), then in diskpart:

  1. DISKPART> automount disable (Disables automount of disks)
  2. Insert USB disk
  3. Find and select correct disk, failure in this step may end you deleting your harddrive. Disk size is way to identify correct disk

    DISKPART> list disk

    Disk ### Status Size Free Dyn Gpt
    ——– ————- ——- ——- — —
    Disk 0 Online 931 GB 2048 KB *
    Disk 1 Online 7452 GB 1024 KB *
    Disk 2 Online 1907 GB 0 B *
    Disk 3 Online 14 GB 2861 MB

    DISKPART> select disk 3

    DISKPART> list disk

    Disk ### Status Size Free Dyn Gpt
    ——– ————- ——- ——- — —
    Disk 0 Online 931 GB 2048 KB *
    Disk 1 Online 7452 GB 1024 KB *
    Disk 2 Online 1907 GB 0 B *
    * Disk 3 Online 14 GB 2861 MB

  4. Then wipe the selected disk

    DISKPART> clean
  5. I think sometimes clean does not clean partition table fully, causing errors later on. Try to get around this changing partition table

    DISKPART> convert gpt

    DiskPart successfully converted the selected disk to GPT format.
  6. Create partition

    DISKPART> create part pri

    DiskPart succeeded in creating the specified partition.
  7. Format partition

    DISKPART> format fs=fat32 quick

    100 percent completed
  8. Close diskpart, remove drive and plug it in again
windows/diskpart_cleanusb.txt · Last modified: 2021/08/11 19:01 by admintomi