How to Format a USB Drive on Linux


USB drives are widely used for storing and transferring data between different devices. However, sometimes you may need to format a USB drive to change its file system or to erase its contents. If you’re using Linux, formatting a USB drive can be done easily through the command line. In this step-by-step guide, we’ll show you how to format a USB drive on Linux using the fdisk utility and the mkfs.vfat command.

Using mkfs.vfat

mkfs.vfat is a command-line utility used on Linux and other Unix-like operating systems to create a File Allocation Table (FAT) file system on a block device, typically a partition or a removable storage device such as a USB drive or SD card. FAT is a file system commonly used in Windows and other operating systems, and it is supported by many devices that use removable storage.

The “mkfs” part of the command stands for “make filesystem,” while the “.vfat” extension specifies that the utility should create a FAT file system. The syntax of the mkfs.vfat command typically includes the device name of the block device to be formatted and any additional options or parameters.

Step 1: Connect USB Drive

Connect the USB drive to your Linux computer’s USB port.

Step 2: Open Terminal

Open the terminal by pressing Ctrl + Alt + T on your keyboard or by searching for it in the applications menu.

Step 3: Get Device Name

To list all the available storage devices on your system, run:


Note down the device name of your USB drive (e.g. /dev/sdb).

Step 4: Unmount USB Drive

To unmount the USB drive so that you can format it, run:

umount /dev/sdb

Step 5: Launch fdisk

To launch the fdisk utility, which you can use to create a new partition on your USB drive, run:

sudo fdisk /dev/sdb

Step 6: Display Partition Table

Type the letter p and press Enter to display the current partition table of your USB drive.

Step 7: Delete Existing Partitions

Type the letter d and press Enter to delete any existing partitions on your USB drive. If there are multiple partitions, you may need to repeat this step until all partitions are deleted.

Step 8: Create New Partition

Type the letter n and press Enter to create a new partition on your USB drive.

Step 9: Choose Partition Type

Choose the partition type by typing the letter p for primary partition, e for extended partition, or l for logical partition and press Enter.

Step 10: Assign Partition Number

Type 1 to assign the partition number and press Enter.

Step 11: Select Starting Sector

Press Enter to accept the default starting sector.

Step 12: Set Partition Size

Type +4G to set the partition size to 4 gigabytes (adjust this value according to your needs) and press Enter.

Step 13: Write Changes

Type the letter w and press Enter to write the changes to the partition table and exit fdisk.

Step 14: Format New Partition

sudo mkfs.vfat -F 32 /dev/sdb1

This will format the new partition on your USB drive as a FAT32 file system.

Step 15: Remove USB Drive

Once the formatting process is complete, run:

sudo eject /dev/sdb

This will safely remove your USB drive from your computer.


Formatting a USB drive on Linux is a straightforward process that can be done through the command line. By following the steps outlined in this guide, you can easily format your USB drive and prepare it for storing or transferring your data. Always remember to back up any important data before formatting your USB drive, as formatting will erase all data on the drive. With a formatted USB drive, you’ll be ready to store and transfer your files with ease.

Please Leave Feedback and Corrections in the Comments

More to Explore

Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *

What are you looking for?

Type in a question or keyword below

Frequently Asked Questions

Do you have any discounts or coupons?

All of our current discounts and deals are listed under the “Promotions” category at the top of the configuration page for each laptop.


What is your return policy?

Any laptop purchased from MALIBAL.COM may be returned or exchanged only in accordance with MALIBAL’S return policy in effect on the date of the invoice or acknowledgment. You must contact us directly before you attempt to return a laptop in order to obtain a Return Material Authorization Number for you to include with your return. You must return the laptop to us in its original packaging and condition with all included manuals, discs, accessories etc.


Do you offer any military or student discounts?

We don’t offer any military or student discounts at this time.


How much is shipping and tax to my state or country?

Shipping costs are determined by cost of notebook and location. Please add a notebook to the cart and then click the, “Estimated Shipping Charges,” link at the bottom of the cart page. Within the US, there are no taxes outside of Nevada. Nevada residents are subject to 8.10% sales tax. For customers outside the US, you will have to pay your local VAT (Value Added Tax) to customs once the notebook arrives in your country.


When is my order shipping?

Laptops usually ship out within 5-7 business days after the order is placed. We also offer rush service (1-3 business days) for $50. Once your laptop ships out we will email the tracking number so that you can see the estimated arrival date. Someone will need to be at the address to sign for the package.


How do I check the status of my order?

We will send you emails and texts with status updates as your order progresses through the different stages.


How do I cancel an order?

You may cancel an order any time up until it ships. After it ships, you will not be able to cancel it, but will instead have to use our return policy in order to return the laptop for a refund. To cancel an order, simply open a sales ticket or sales chat and give the representative your order information, and they will cancel the order for you and send you confirmation via email and text.


How do I make a change to my order?

You may make changes to your order up until it ships. To modify an order, simply open a sales ticket or sales chat and give the representative your order information and specify which changes you want to make. Please note: You cannot change the shipping address on an order.


Do you price match?

We do not currently offer any price matching.


How do I track my order after it ships?

You can view your tracking status via the order page in your account.



MALIBAL is an innovative technology company that produces high-performance, custom linux laptops for developers and content creators; mobile workstations for engineers, scientists, video editors, 3D modelers, and animators; and mobile servers for enterprise applications.

On our site, you will find information about the best custom linux laptops, such as our Aon S1 and Aon L1 models, our customers, new articles, latest news, guides, features, and more.