Format usb flash drive from command line on linux/ubuntu

If there is a lot of content on the usb flash drive and you want to erase all of it quickly then a simple way to do it is by formatting it. On linux the drive can be formatted from the commandline.

Here are the simple steps

1. First insert the usb drive.
2. Once the system has detected it run the mount command from the terminal.

$ mount
/dev/sda5 on / type ext4 (rw,errors=remount-ro,user_xattr)
/dev/sdb1 on /media/E93D-1723 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)

Find out the device from the mount output. In this case it is /dev/sdb1

3. Next format it using the mkfs command

sudo umount /dev/sdb1
sudo mkfs -t vfat /dev/sdb1
sudo eject /dev/sdb1

First unmount it, then create filesystem/format using the mkfs command and then eject when done.

Can also use gparted so that you dont have to remember the commands.







Last Updated On : 7th August 2013

Subscribe to get updates delivered to your inbox

Leave a comment