Categories: TutorialsUbuntu

How to Format USB in Ubuntu

There can be several reasons you may want to format your USB drive. For instance, the most common reason is to quickly wipe out all data stored in it or to change the file system to make it compatible with a different system. You may also want to format a USB drive if it contains some malicious data. Regardless of the reason, Ubuntu allows you to format your USB drive using the command line and the GUI methods.

In today’s post, we will cover how to format a USB drive in Ubuntu through three different methods. Make sure to backup important data as formatting will wipe out everything stored in it.

Method#1Formatting
Sponsored
USB through Command Line

In this method, we will format the USB drive using the command line. Follow the below-mentioned steps for the formatting procedure:

1. First, you will need to identify your USB drive so that you do not mistakenly format any other drive. Run the command below to find your USB drive name:

$ df -h

This command will list all the partitions along with details as shown below:

From the list, you can find your USB drive mounted on a directory. In our case, it is /dev/sdb1 listed at the end of the output. If your USB is not automatically mounted by the system, you can manually mount it.

2. Before formatting, you will need to unmount the USB. To unmount it, run the command below:

$ sudo umount /dev/sdb1

3. Then run the command below to format the USB drive:

$ sudo mkfs.vfat /dev/sdb1

Now your drive will be formatted.

Note: If you do not unmount the USB drive, the command will not format it. Instead it will return the below message. So make sure to unmount the USB drive first before formatting it.

Method#2 Formatting USB through GUI

There are two ways to format a USB drive through a graphical interface: using the GParted utility and File Manager.

Using GParted utility

In this method, we will format the USB drive through the graphical method using the GParted utility. Follow the below-mentioned steps for the formatting procedure:

1. Install GParted utility through the command below:

$ sudo apt install gparted

Enter sudo password. Then it will ask if you want to continue the installation. Press y and then the Return key. After the GParted utility is installed, open it from the Applications menu.

1. In the GParted window, click the drop-down icon on the right side to select your USB device partition which in our case is /dev/sdb.

2. Before formatting, you will need to unmount the partition. Right-click the USB partition and select Unmount.

Sponsored

3. After unmounting the partition, right-click it again and select Format to. Then from the list of file systems, select the desired file system for your USB.

4. Now click the green color icon on the toolbar to apply the operations.

It will warn you about data loss that will occur after formatting and advise you to backup your data. If you want to proceed, click Apply.

Now formatting of your USB device will be started. Once done click Close.

Now your drive will be formatted.

Using File Manager

In the following method, we will format the USB through the graphical method using the File Manager. Follow the below-mentioned steps for the formatting procedure:

1. Open File Manager in your system. On the left side of the File Manager, you will find the mounted USB drive.

2. In order to format your USB drive, right-click the mounted USB drive and select Format.

3. Then in the below Format Volume window, type any name for your USB drive and select Type. Here I have selected For use with all systems and devices (FAT).

You can also switch on the Erase option which will overwrite all the existing data. However, this will take a longer time. Once done, click Next.

4. Now you will be asked to verify the details. In case you want to change something, you can go back by clicking the Previous button. If you are okay with everything, click Format.

Now your drive will be formatted.

In this post, we covered how to format a USB drive to wipe out its data and fix problems. You can use any method either the command line or the graphical methods (GParted utility or File Manager) for formatting a USB drive.

Ubuntu Server Admin

Recent Posts

Azure VM utils now included in Ubuntu: boosting cloud workloads

Ubuntu images on Microsoft Azure have recently started shipping with the open source package azure-vm-utils…

4 hours ago

Edge Networking gets smarter: AI and 5G in action

Organizations everywhere are pushing AI and networks closer to the edge. With that expansion comes…

4 hours ago

When Your Hash Becomes a String: Hunting Ruby’s Million-to-One Memory Bug

Every developer who maintains Ruby gems knows that sinking feeling when a user reports an…

1 day ago

Why we brought hardware-optimized GenAI inference to Ubuntu

On October 23rd, we announced the beta availability of silicon-optimized AI models in Ubuntu. Developers…

6 days ago

Canonical and NVIDIA BlueField-4: a foundation for zero-trust high performance infrastructure

At NVIDIA GTC Washington D.C., Canonical is pleased to support the arrival of the NVIDIA…

1 week ago