x32x01

ADMINISTRATOR
maxresdefault.jpg

The easiest and fastest way to format a USB drive in Linux is through the terminal. The procedure consists of three steps:
  1. Locating the USB drive.
  2. Unmounting and formatting the USB drive.
  3. Verifying the process was successful.
Follow the instructions below to format a USB drive using the terminal.

Step 1: Locate USB Drive
Open the terminal and run the following command:
Code:
df

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.

list-all-partitions.png

Step 2: Unmount and Format USB Drive
Unmount the USB drives before formatting. To do so, run this command:
Code:
sudo umount /dev/sdb1

unmount-usb.png

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:
Code:
sudo mkfs.vfat /dev/sdb1
  • To format a USB drive using the NTFS file system run:
Code:
sudo mkfs.ntfs /dev/sdb1
  • To format a USB drive in accordance with the exFAT file system use:
Code:
sudo mkfs.exfat /dev/sdb1

Step 3: Verify USB Drive Formatting
Confirm the formatting process has completed successfully:
Code:
sudo fsck /dev/sdb1

A USB drive with no files indicates successful formatting.

verify-formatting-terminal.png
 
Top