List your block devices to find the location of the device:
$ lsblk
Unmount the drive. Replace dev/sdb1 with your drive location.
$ sudo umount /dev/sdb1
An optional, but practical step is to erase the drive:
Make double-damn sure you are selecting the correct device (this example is /dev/sdb). Replace /dev/sdb with your device. This can take a while depending on how large your device is. You may get an error dd: error writing '/dev/sdb': No space left on device but be patient it will finish writing.
$ sudo dd status=progress if=/dev/zero of=/dev/sdb bs=4k && sync
Create a new partition map. Again, change dev/sdb to your device:
$ sudo fdisk /dev/sdb
This next part is interactive:
- Type
othenenterto create a new DOS disklabel - Type
nthenenterto add a new partition - Type
pthenenterto make it a primary partition - Type
1thenenterto set the partition as the first partition - Press
enteragain to accept the default first sector - Press
enteragain to accept the default last sector (whole disk) - Type
wthenenterto write the partition label and exit
Now you need to format the drive. Replace mydrive of the label/name you want to use for your drive.
$ sudo mkfs.vfat -F 32 -n 'mydrive' /dev/sdb1