How to Format a USB Flash Drive in Linux

By Al Bondigas

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.

Using mkfs

Step 1

Plug your flash drive into a USB port.

Step 2

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 3

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 4

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 5

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

Using gparted

Step 1

Type "gparted" in a root shell.

Step 2

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

Step 3

Unmount the flash drive if gparted indicates it is mounted.

Step 4

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

Step 5

Click "Apply."

Step 6

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

Tips & Warnings

  • The vfat32 format is recommended if you need to use the thumb drive in Windows computers. Linux can read and write to the FAT file system, but Windows will not read Linux file systems.
  • Linux file systems include ext2, ext3 and reiserfs.
  • Formatting a partition will destroy any data you have on the thumb drive. If you have any data on it, back it up to your hard drive.
  • Be careful working as root, as you have access to system files and can damage them.