Linux Commands

Format Flash Drive With Ext2

“A File Unit is made up of the Logical Partition that is linked to a Block Group, as well as the Blocks and Interruptions. When files are stored within a single block group, this structure helps to reduce the average time spent searching for them. Different formats are available for formatting a USB, such as EXT2, EXT3, and EXT4. These are all file systems created for Linux. We can format the flash drive, SD card, and other devices with different partition methods such as ext2, ext3, ext4, FAT32, etc.

We will discuss in this post how to format a USB or flash drive with ext 2.”

Format Flash Drive With Ext2 Using the Parted Utility

GNU Parted is a command-line utility that allows you to create and manage partition tables. Most Linux distributions now come with the parted tool pre-installed. You can verify the parted installation on your system by running this command:

$ parted –version

If parted is not already installed on your system, you can easily install it on your Ubuntu Linux distribution by using the following command:

$ sudo apt install parted

Insert the USB flash drive into your Linux system and use the “lsblk” command to identify the device name:

$ lsblk

The connected USB device name will display in the following devices list:

To format the flash drive with ext2 filesystem, follow the below-mentioned steps:

Step 1: Create a GPT partition table by using this command:

$ sudo parted /dev/sdb --script -- mklabel gpt

Step 2: Create an EXT2 partition that usually takes the whole space:

$ sudo parted /dev/sdb --script -- mkpart primary ext2 0%

Step 3: Now, start Formatting the partition to ext2:

$ sudo mkfs.ext2 -F /dev/sdb4

Step 4: Verify it by displaying the partition table:

$ sudo parted /dev/sdb4 --script print

Format Flash Drive With Ext2 Using the GParted Application

First, install the Gparted package on your system by using this command:

$ sudo apt install gparted

Now, open the Gparted interface and select the USB that you want to format from the top of the window:

Right-click on the partition table. Select “Format to an ext2” filesystem from the list.

Now, click on “Apply” to complete the formatting of the USB.

In a while, you will notice that your flash drive will be formatted with the ext2 filesystem. Close the windows after formatting your USB.


We demonstrated in this post how to format the flash drive or USB in ext 2. In Linux, formatting a USB device is simple. Insert the storage device, build a partition table, and format it using Ext2 or another file system.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.