The easiest and fastest way to format a USB drive in Linux is through the terminal. The procedure consists of three steps:
- Locating the USB drive.
- Unmounting and formatting the USB drive.
- Verifying the process was successful.
Step 1: Locate USB Drive
Open the terminal and run the following command:
The terminal prints out a list of all mounted partitions and relevant information: used space, available space, used space percentage, and the path.
Locate the USB in the list and find the corresponding device. In this example, the USB drive is /dev/sdb1.
Note: If you are unsure of the drive designation, unplug the USB drive temporarily before running the df command again. The device that is now gone from the list is your USB device.
Step 2: Unmount and Format USB Drive
Unmount the USB drives before formatting. To do so, run this command:
sudo umount /dev/sdb1
After unmounting, format the USB drive using the preferred file system (replace sdb1 with the name of your device):
- To format a USB drive with FAT32 file system, use:
sudo mkfs.vfat /dev/sdb1
- To format a USB drive using the NTFS file system run:
sudo mkfs.ntfs /dev/sdb1
- To format a USB drive in accordance with the exFAT file system use:
sudo mkfs.exfat /dev/sdb1
Step 3: Verify USB Drive Formatting
Confirm the formatting process has completed successfully:
sudo fsck /dev/sdb1
A USB drive with no files indicates successful formatting.