top of page

Formatting a USB stick from Terminal/Command Prompt

Writer's picture: Luke ChikkalaLuke Chikkala

Updated: May 17, 2022

On macOS

WARNING: Be cautious when using the following commands.


Find the correct partition of the disk.

diskutil list

From the above picture, my 8 GB USB stick is partitioned at

/dev/disk2 

Format that partition using:

diskutil eraseDisk FAT32 BOB/dev/disk2

diskutil is a macOS terminal tool.

eraseDisk is the parameter to erase the disk. FAT32 is the file system that the USB will be formatted to. BOB is the new name given to the USB. /dev/disk2 is the partition of the USB (from the above picture). The terminal should then go on to format the USB.

 

On Windows


Open Command Prompt using Administrative Privileges. Open diskpart, a command-line disk partitioning tool of Windows.

diskpart

Find the correct partition of the disk.

list disk

This will list all the mounted drives. Select the disk to be formatted.

select disk 1

Then followed by these commands:

clean

create partition primary

active

format FS=FAT32 label=BOB quick

Optionally, these commands can be combined as:

clean && create partition primary && active && format FS=FAT32 label=BOB quick

Optionally you can also assign a letter to the drive here using:

assign letter=Z

Exit the DiskPart

exit

Cheers, Luke

45 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post

©2021 by lukechikkala.

bottom of page