lots of tech info here

Format USB flash drive using dd

Published on 19 February 2020 | No Comments

This is a tutorial on how to format a USB flash drive using the dd command.

USB drive

You can format a flash drive using a number of GUI tools - such as Disk Utility. Unfortunately, this does not work properly all the time. If you have a flash drive which has some kind of Linux installed on it and it is split into various partitions, Disk Utility may not detect all partitions. In such scenarios, it's best to use the command line tool called dd.

Linux

First, find the flash drive mounted in the system:

fdisk -l

Assume the flash drive is mounted on /dev/sdb. Now, unmount the device:

umount /dev/sdb

Format the flash drive:

sudo dd if=/dev/zero of=/dev/sdb bs=1m

After several minutes, the formatting will be completed.

macOS

First, find the device:

diskutil list

Assume the flash drive is mounted on /dev/disk2. Now, unmount it:

diskutil unmountDisk /dev/disk2

Format the flash drive (note the rdisk2 instead of disk2):

sudo dd if=/dev/zero of=/dev/rdisk2 bs=1m

After several minutes, the formatting will be completed.

urandom instead of zero

You may also use this command to fill the filesystem with random numbers instead of 0s.

sudo dd if=/dev/urandom of=/dev/rdisk2 bs=1m

Created on 19 February 2020

If you liked this article, follow us on Facebook and Twitter (@aruljohn).

Share this with Others

Subscribe

Tags