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.
Plug your flash drive into a USB port.
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.
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.
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.
Watch the readouts in your root shell. When it indicates it is done, your drive is formatted.
Type "gparted" in a root shell.
Select "/dev/hdb1" from the box in the upper-right corner of the gparted display.
Unmount the flash drive if gparted indicates it is mounted.
Right-click on the display line for /dev/sdb1. Select "Format to," then the format you want for your drive.
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.