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.
Here at LinuxAPT, we shall look into how to format the USB drive in Ubuntu Linux system.
Make sure to backup important data as formatting will wipe out everything stored in it.
Here, we will format the USB drive using the command line. So you can follow the below steps.
1. To begin, 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:
This command will list all the partitions along with details.
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 below command:
$ 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 "drive a mounted filesystem" message. So make sure to unmount the USB drive first before formatting it.
There are two ways to format a USB drive through a graphical interface: using the GParted utility and File Manager.
i. 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.
2. 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.
3. Before formatting, you will need to unmount the partition. Right-click the USB partition and select Unmount.
4. 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.
5. 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.
ii. Using File Manager
Here, 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 Format Volume window, type any name for your USB drive and select Type. Here we 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.
This article covers how to format a USB drive to wipe out its data and fix problems in Ubuntu Linux system. In fact, You can use any method either the command line or the graphical methods (GParted utility or File Manager) for formatting a USB drive.