Format a pendrive


Erase everything in the pen drive (This step is Optional):

sudo dd status=progress if=/dev/zero of=/dev/sdb bs=4k && sync

Replace /dev/sdb with your corresponding device.

Type very carefully this name or your may end up erasing one of your other disks. This will take some time. (option status=progress is not mandatory but provide you some feedback)

It will pretend to be stuck. Just be patient.

for example:

dd if=/dev/zero of=/dev/sdb bs=4k && sync
dd: error writing '/dev/sdb': No space left on device

1984257+0 records in
1984256+0 records out
8127512576 bytes (8.1 GB) copied, 1236.37 s, 6.6 MB/s

Make a new partition table in the device:

sudo fdisk /dev/sdb

Then press letter o to create a new empty DOS partition table.

Make a new partition:

Press letter n to add a new partition. You will be prompted for the size of the partition. Making a primary partition when prompted, if you are not sure.

Then press letter w to write table to disk and exit.

Format your new partition.

See your new partition label with the command lsblk In my case it is /dev/sdb1. Once again pay attention to this name as there will not be any protection to prevent you to erase an other disk.

Issue the command below to format the new volume:

sudo mkfs.vfat /dev/sdb1

Please replace /dev/sdb1 with your corresponding device.

Eject the device:

sudo eject /dev/sdb

Author: Sebastian Emilio Narvaez

Created: 2019-12-06 Fri 11:58

Emacs 25.2.2 (Org mode 8.2.10)