Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Facebook Twitter Instagram
Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Tech News Today
Home»Linux»How To Format USB In Linux (5 Easy Ways)

How To Format USB In Linux (5 Easy Ways)

AnupBy AnupAugust 22, 2022
format usb linux

Formatting a USB Drive in Linux is a straightforward process for the most part, but you may encounter a few roadblocks along the way.

For instance, users are often unsure as to what file system they should format the USB with. Generally, you should stick to ext4 for the best performance and stability. But if cross-platform compatibility is a concern, you can instead go with exFAT or FAT32.

Users have also reported facing issues with the USB not being usable after formatting. We’ve detailed how you can format the USB properly and resolve all such issues in this article.

Table of Contents

  • How to Format USB in Linux
    • Using GParted
    • GNOME Disks
    • Make File System (mkfs)
    • Using dd
    • Using Shred
  • Problems When Formatting USB

How to Format USB in Linux

We’ll use ext4 as an example, but you can choose your preferred file system when formatting the USB. Remember to backup any important data beforehand. Also, make sure you specify the correct device to format when performing the command-line methods, as it’s easy to mess this up and format the wrong drive.

Using GParted

GParted is a GUI-based partition manager. Using GParted is generally the easiest way to format USB drives on most distros, so if you’re new to Linux, this should be your go-to option. Here are the necessary steps for this:

  1. First, you’ll have to install GParted. On Debian-based distros, you can do so with the following command:
    sudo apt install gparted
  2. Open GParted and enter your password to authenticate.
  3. Select the USB from the top right.
    gparted-select-device
  4. Right-click the USB and select Unmount.
  5. Next, right-click the data partition and select Format To > ext4.
    gparted-format-to-ext4
  6. Click on Apply all operations.
  7. Afterward, right-click it once more and select Mount.
  8. If the Mount option is greyed out, execute the following commands in the terminal:
    sudo mkdir /mnt/usb
    sudo mount <devicepath> /mnt/usb

    sudo mount device

GNOME Disks

GNOME Disks is the default partition manager for GNOME desktop environments. It’s pre-installed in most of the popular Linux distros, including Ubuntu. Here are the steps to format your USB using this utility:

  1. Open the Disks utility and select the USB.
  2. Select the partition you want to format and click on the settings cog.
  3. Select Format partition and rename the volume if you want.
    gnome disks format partition
  4. You can enable Erase to overwrite the existing data, and you can also select the filesystem. Afterward, press Next > Format.
    gnome disks format volume
  5. If you want to format the entire drive at once instead, click on the triple-dot button and select Format Disk > Format.
    gnome disks format disk
  6. Press the + button to create a partition in the unallocated space.
  7. Adjust the partition size and other values as before and create the partition.
  8. Now, mount the USB to make it accessible again.

Make File System (mkfs)

GParted performs the disk operations through the mkfs utility. So, you can think of this method as using GParted but via the command line, although their origins are actually the other way around. In any case, here are the steps to format your USB using mkfs:

  1. Use df -h to check the USB’s device path.
  2. Unmount the USB using sudo umount <devicepath>.
    sudo umount device
  3. Type sudo mkfs -t <filesystem> <devicepath>.
  4. Replace <filesystem> with your preferred filesystem (ext4, vfat, nfts, etc.) and execute the command.
    sudo-mkfs-ext4-device
  5. Afterward, mount the USB with the following commands:
    sudo mkdir /mnt/usb
    sudo mount <devicepath> /mnt/usb

Using dd

You can use dd to either zero-fill or write random data to your USB drive, essentially formatting it and making the data unrecoverable. This is a good idea if you plan to lend the USB or sell it to someone.

Using dd is very simple; the base syntax is as follows:
dd if=source of=<targetdevice> <options>

For instance, if you wanted to write random data instead of zeroes to a USB mounted at /dev/sdb1, you would use the following command:
dd if=/dev/urandom of=/dev/sdb1 bs=16M

sudo-dd-format-usb

Using Shred

Shred is essentially dd but more secure. Its overwriting patterns are optimized to destroy as much residual data as possible, so this is your best bet if you’re trying to wipe the USB completely.

The base syntax for Shred is shred <options> <devicepath>. In our example, we’ll use the -f option to force write, -n to specify the number of times to overwrite, and -v to display the ongoing operation. But for the full list of options, you can check the shred man page.

sudo-shred-vf-device

Problems When Formatting USB

A commonly reported issue regarding USBs is that users installed Linux onto the USB, and now it’s not usable for data transfer. Reverting a bootable USB to a non-bootable state is very simple; all you have to do is format it.

The USB not being mountable after formatting is another common problem. This time, it usually happens because the formatting tools in Linux are capable of removing everything from the drive, including the filesystem signatures. As there are no partitions to mount, you’ll have to create one first.

If sudo mount <device> doesn’t let you auto-mount, you should create a mount point first and then mount the device manually as such:
sudo mkdir /mnt/usb
sudo mount <devicepath> /mnt/usb

Finally, another problem worth mentioning is that the formatting process gets interrupted, and the USB doesn’t get detected afterward. Users generally use lsusb, and when they find that the system isn’t detecting the USB at all, they assume they bricked the device.

While this is certainly a possibility, we’ve found that simple fixes like restarting the PC and reseating the USB a few times are surprisingly effective at resolving this issue.

how-to
Anup

Anup has been tinkering with PCs for over 15 years and writing professionally for almost 5. At Tech News Today, he mainly covers Windows systems, Linux, networking, and hardware-related topics.

Related Posts

how to change boot order on linux

How to Change Boot Order on Linux

December 16, 2022
make-command-not-found

How to Fix “Make: Command Not Found” Error

September 20, 2022
linux terminal for windows

How to Install Linux Terminal on Windows

September 19, 2022
How-to-force-Quit-an-app-on-Linux

How to Force Quit an App on Linux

August 30, 2022
best linux for virtualbox

8 Best Linux Distros to Try in VirtualBox

August 30, 2022
ifconfig command not found

How To Fix “ifconfig Command Not Found” Error?

December 18, 2022
View 2 Comments

2 Comments

  1. bt on November 11, 2022 10:03 am

    What happened to the gui usb format apps?

    Reply
    • Anup on November 11, 2022 12:02 pm

      Hi Bt,
      We included GParted and GNOME Disks as these are the most popular GUI-based methods. Are you referring to any other specific app in your question?

      Reply

Leave A Reply Cancel Reply

Latest Posts
what is ghost of tsushima legends

What is the Ghost of Tsushima Legends Mode

January 12, 2023
raid 5 vs raid 10

RAID 5 Vs RAID 10 – Which One Is Better?

January 12, 2023
best-tv-settings-for-gaming

Best TV Settings for Gaming

January 9, 2023
You may also like
tv-screen-goes-black-randomly

TV Screen Goes Black Randomly? Try These 11 Fixes

January 15, 2023
how to find unique values in excel

How to Find Unique Values in Excel

January 15, 2023
how-to-open-and-use-chrome-settings

How to Open and Use Chrome Settings

January 16, 2023
Recommended
Cookie Clicker Garden Guide

Cookie Clicker Garden Guide to Unlocking Every Seed

September 26, 2021
monitor no signal

Computer Turns On But Monitor Says No Signal (9 Ways To Fix)

November 10, 2022
Facebook Twitter Pinterest
  • Home
  • About Us
  • Editorial Guidelines
  • Fact-Checking Policy
  • Privacy Policy
  • Affiliate Disclosure
© 2023 TechNewsToday.

Type above and press Enter to search. Press Esc to cancel.