It happens every now and then that we need to format a USB drive to change the file system, delete the data completely or get rid of a virus that has infected it. There are several ways to format a USB drive, and we’ve listed a few of them in this article so you can see which one works for you. You can format a USB drive both from the command line and from the graphical user interface, whichever you prefer.
Format USB Drive Through the Command Line
Formatting a USB drive is very easy via the command line. Even a beginner can format a USB drive using the commands described here.
1. the first step is to identify the USB drive correctly to avoid formatting another drive by mistake. Open the Terminal application via Dash or the Ctrl+Alt+T key combination and type the following command:
$ df -h
The last line in the output lists /dev/sdb1 as our USB drive.
2. Use the following command in order to format the USB as per the VFAT file system:
$ sudo mkfs.vfat /dev/sdb1
You will be using the location as per the output you got from the df -h command.
3. You can only format an unmounted USB drive, otherwise, you will get the following message:
Therefore, please unmount the drive through the following command:
$ sudo umount /dev/sdb1
Now when you run the formatting command as a root user, your USB drive will be successfully formatted.
Format USB Drive Through the GUI
Format Directly from the File Manager
You can format a USB drive through the graphical interface of your Ubuntu system as follows:
1. Open the file manager and then right-click the USB drive name that you want to format, from the left pane.
2. Click the Format option from the right-click menu. The following dialog will open.
3. Enter a volume name for your USB drive. In the figure above we have entered USB as the volume name.
You can delete the existing data on your USB drive by clicking the Delete button. In this case the existing data on your system will be overwritten and the formatting process will take a little longer. You can also specify the file system you want the USB drive to have. 4.
4. Click the Next button in the upper right corner, which becomes active only after you have entered all the details.
The following Confirm Details dialog will open so you can confirm the formatting details. Please make sure you format the correct volume by looking at the location information. This will prevent you from formatting an unwanted storage and damaging your system.
4. Click the Format button after confirming the details.
Your USB drive will be formatted and ready for use, based on the volume name, file system, and data erasing options you specified.
Format USB Drive through the GParted tool
You can also format your USB drive through a tool called Gparted. Gparted in an open source partition editor for Linux systems. Follow these steps to install and use this tool:
1. Open the Terminal through CTRL+ALT+T or through your Ubuntu Dash.
2. Enter the following command in order to install the open-source tool GParted:
$ sudo apt-get install gparted
3. Enter y when prompted by a y/n option for continuing installation.
The GParted tool will be installed on your system.
4. In order to access the GParted from your desktop, search for it through the Dash as follows:
5. Click on the GParted icon to open the application.
6. You will be asked to provide authentication for root user as only a root user can access and use this application. Provide the password and then click Authenticate.
The tool will open, displaying the /dev/sda partitions of the hard disk by default.
7. Since we want to view details of removable media, select that from the drop-down option located at the top-right corner. You will now be able to see the partitions of removable media as follows:
8. You need to unmount a USB drive before formatting it. Select the USB partition that you want to format, right-click and then click Unmount.
9. Now when you right-click the USB partition, the ‘Format to’ option will become active. Click the Format to option and then select a file system you want to use for your USB drive.
We have selected ntfs in this example. This operation will be added as a pending operation.
10. In order to apply this operation, click the tick icon from the top bar to apply all operations.
11. The following dialog will appear, asking you for confirmation about applying all the pending operations. Click the Apply button when you are sure about your choice.
The formatting process will begin:
You will be notified when the operations have been completed as follows:
12. Click the Close button; you now have a formatted USB drive with the file system you specified.
After reading this article, you may have found a way to format your USB drive for better use. You can use both the command line and the user interface to format a USB drive after you unmount it. The powerful partition editing tool GParted will also help you format your drive based on a long list of file types.