Sunday, August 27, 2023

Use diskpart CLI to reformat a Linux boot USB flash drive

Useful for reformatting a flash drive after using it as a Linux boot drive. 

In a Windows 10 command prompt, running as administrator:

C:\Windows\system32>diskpart

Microsoft DiskPart version 10.0.19041.964

Copyright (C) Microsoft Corporation.

On computer: YOURPC

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          476 GB  1024 KB        *
  Disk 1    Online          931 GB  1024 KB        *
  Disk 2    Online         7396 MB  4509 MB        *

DISKPART> select disk 2
Disk 2 is now the selected disk.

DISKPART> clean
DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.

DISKPART> format fs=fat32 quick
  100 percent completed

DiskPart successfully formatted the volume.

DISKPART> exit
Leaving DiskPart...