How to Format USB Drives in Linux

November 19, 2020

Introduction

Occasionally, it is necessary to format the USB drive (for example, when changing the file system or deleting data). However, many Linux users are afraid to start the formatting process, thinking it is either a very complicated or time-consuming task.

In this tutorial, you will learn how to format the USB drive in Linux using three quick and simple methods:

  • Terminal
  • Disk Utility
  • GParted tool
How to Format USB Drives in Linux.

Prerequisites

  • A system running Linux
  • A USB drive
  • Access to the terminal/command line
  • A user account with sudo/root privileges

Which File System to Use for USB Formatting?

There are many file systems in use, differing by maximum file size and operating system compatibility. The most commonly used file systems when formatting a USB drive are:

  • FAT32
  • NTFS
  • exFAT

Their main features and differences are:

File SystemSupported File SizeCompatibilityIdeal Usage
FAT32up to 4 GBWindows, Mac, LinuxFor maximum compatibility
NTFS16 EiB – 1 KBWindows, Mac (read-only), most Linux distributionsFor internal drives and Windows system files
exFAT16 EiB – 1 KBWindows, Mac, Linux (requires extra drivers to access)For files larger than 4 GB

Method 1: Format USB Using the Terminal

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:

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.


Listing all partitions with df command.

Step 2: Unmount and Format USB Drive

Unmount the USB drives before formatting. To do so, run this command:

sudo umount /dev/sdb1
Unmounting the USB drive.

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.

Verifying that the formatting process is done.

Method 2: Format USB Using Disk Utility

The GNOME Disk Utility is a graphical tool for partitioning and formatting storage drives in Linux.

Follow the outlined steps to format a USB drive using the Disk Utility tool.

Step 1: Open Disk Utility

To open the Disk Utility:

  1. Launch the Application menu.
  2. Type “disk” in the search bar.
  3. Click the Disks icon.
Opening the Disk Utility

Step 2: Identify the USB Drive

Locate the USB drive from the left pane and select it. The right pane contains details about the drive, such as model name, size, serial number, and contents.

Locating USB drive in the Disk Utility.

Step 3: Format the USB Drive

1. Click the gear icon and select the Format Partition option from the drop-down menu.

Selecting the formatting option.

2. Type the preferred name for the USB drive.

Optionally, enable the Erase option to overwrite the existing data from the USB drive. Choose the file system format and click on the Next button.

Setting up the formatting options.

3. A pop-up appears with a warning message about data deletion and formatting details. Start the formatting process by clicking the Format button.

Warning about data deletion.

4. The progress line displays the remaining time until the formatting process completes. Close the Disk Utility when the job completes.

Formatting progress line displaying remaining time until the operation ends.

Method 3: Format USB Using GParted Tool

Formatting via GParted takes the most time as it involves an additional step – installing the tool. However, it is a handy tool that you can use even after you have finished formatting the USB drive.

Follow the steps below to format a USB drive using the GParted tool.

Step 1: Install GParted Tool

1. Open the terminal and install the GParted tool using this command:

sudo apt install gparted 

Confirm the installation by pressing y and then hit Enter. Wait until the process completes.

Installing the GParted tool.


2. Run the GParted tool with:

sudo gparted

The terminal loads the GParted home screen.

The GParted home screen.

Step 2: Start the Formatting Process

1. Select the /dev/sdb option from the drop-down menu at the top of the GParted home screen.

Selecting the USB drive in the GParted tool.

2. Right-click the /dev/sdb1 partition and select Format to. Choose the preferred file system from the list to continue.

Selecting formatting settings in GParted tool.

Step 3: Start the Process

1. Click the green checkmark button to apply all operations.

Applying formatting operation.


2. A pop-up appears with a warning message about data deletion. Click Apply to continue.

A pop-up containing warning message.


The GParted formats the drive. The time required for the formatting process varies depending on the size and type of the USB drive.

Formatting process.


3. Click the Close button to exit the menu when the operation completes.

Closing formatting menu in GParted tool.

Conclusion

In this article, you learned how to format a USB drive in Linux using several methods. Additionally, we went through the main features and differences between the three most commonly used file systems.

Was this article helpful?
YesNo
Nevena Pavlicic
Nevena Pavlicic is an aspiring Technical Writer at PhoenixNAP with experience in writing user manuals and blog posts. She has always enjoyed researching and building knowledge on cutting edge technologies, but she is also passionate about simplifying complex concepts.
Next you should read
Introduction to the Linux File System
October 21, 2020

A file system is a set of processes that controls how, where and when data is stored and retrieved from a...
Read more
How to Mount NTFS Partition in Linux
October 8, 2020

In Linux, an NTFS partition is accessed in dual-boot setups where file exchange between drives is required...
Read more
How to Create Partitions in Linux
September 23, 2020

In Linux systems, in order to use storage devices such as Hard Drives and USB drives, you need to understand...
Read more
How to Check Disk Space in Linux
April 13, 2020

This tutorial shows how to display disk usage from a command line in Linux. It is important to know how much...
Read more
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.