How to Format a USB Flash Drive in Linux

Although most USB flash drives come out of the box ready for use, there may be times when you need to reformat one. A file system could become corrupted, or you may want to change the flash drive to another file system. Sometimes it may be necessary to clean the whole flash drive out and start over. With a Linux system, there are several ways to format your USB flash drive. Once formatted, the flash drive is handy as a backup option, or for carrying your work files with you.

...
Linux has several tools for formatting your USB flash drive.

Using mkfs

Step

Plug your flash drive into a USB port.

Step

Unmount the flash drive if it automatically mounts itself upon insertion. In a root shell, type "umount /dev/sdb1" without the quotes. If necessary, replace "sdb1" with the name Linux assigns the flash drive.

Step

Choose a file format for your flash drive. If you plan on occasionally using the drive with a Windows system, you will want a vfat format.

Step

Type "mkfs -t vfat /dev/sdb1" without the quotes. This tells the computer you wish to format /dev/sdb1 (the USB drive) with a vfat file system.

Step

Watch the readouts in your root shell. When it indicates it is done, your drive is formatted.

Using gparted

Step

Type "gparted" in a root shell.

Step

Select "/dev/hdb1" from the box in the upper-right corner of the gparted display.

Step

Unmount the flash drive if gparted indicates it is mounted.

Step

Right-click on the display line for /dev/sdb1. Select "Format to," then the format you want for your drive.

Step

Click "Apply."

Step

Watch the gparted screen. It will let you know when the operation is complete.