Again and again, we need to format the USB drive to change the file system, completely erase the data or get rid of the virus that infects them. There are various ways to format a USB drive, and in this article we have listed some of them so you can see which one is right for you. You can format the USB both through the command line and through the graphical interface, depending on what is convenient for you.
The commands and procedures described in this article were executed on the Ubuntu 18.04 LTS system.
Formatting a USB drive through the command line
Formatting a USB drive is very easy using the command line. Even a novice can format a USB drive using a simple process and the commands that we describe here.
1. The first step is to correctly identify the USB drive to avoid accidentally formatting any other drive. Open the Terminal app through Dash or through Ctrl + Alt + T shortcut and enter the following command:
$ df -h
The last line in the output lists / dev / sdb1 as our USB drive.
2. Use the following command to format the USB according to the VFAT file system:
$ sudo mkfs.vfat /dev/sdb1
You will use the location according to the output from the df -h command.
3. You can only format a disconnected USB drive, otherwise you will receive the following message:
Therefore, please disconnect the drive using the following command:
$ sudo umount /dev/sdb1
Now, when you run the format command as root, your USB drive will be formatted successfully.
Formatting a USB drive through a graphical interface
Format directly from the file manager
You can format the USB drive through the graphical interface of your Ubuntu system as follows:
1. Open the file manager and then right-click the name of the USB drive you want to format in the left pane.
2. Select the “Format” option in the context menu. The next dialog will open.
3. Specify the volume name for your USB drive. In the image above, we entered USB as the name of the volume.
You can delete existing data on a USB drive by clicking the “Erase” button. In this case, the existing data in your system will be overwritten, and the formatting process will take a little longer. You can also specify the file system that you want to have on a USB drive.
4. Click Next, located in the upper right corner, which becomes active only after you provide all the specifications.
The next Confirm Details dialog box opens up the possibility of confirming formatting details. Please make sure that you format the correct volume by viewing the location information. This will not allow you to format any unwanted storage and therefore damage your system.
4. Click the Format button after confirming the details.
Your USB drive will be formatted and ready for use in accordance with the volume name, file system, and data erase options that you specify.
Format your USB drive using the GParted tool
You can also format the USB drive using a tool called Gparted. Gparted in the open source partition editor for Linux systems. Follow these steps to install and use this tool:
1. Open Terminal through CTRL + ALT + T or through your Ubuntu Dash.
2. Enter the following command to install the GParted open source tool:
$ sudo apt-get install gparted
3. Enter y in response to the y / n parameter prompt to continue the installation.
The GParted tool will be installed on your system.
4. To access GParted from your desktop, find it through Dash as follows:
5. Click on the GParted icon to open the application.
6. You will be asked to provide authentication for the root user, since only the root user can access and use this application. Enter the password and click “Authentication”.
The tool opens, displaying the default / dev / sda partitions of the hard disk.
7. Since we want to view information about removable media, select it in the drop-down list located in the upper right corner. Now you can see the removable media sections as follows:
8. Before formatting, you must disconnect the USB drive. Select the USB partition you want to format, right-click and select “Unmount.”
9. Now that you right-click on the USB section, ‘Format toOption ’will become active. Click Format To, and then select the file system that you want to use for your USB drive.
We selected NTFS in this example. This operation will be added as a pending operation.
10. To apply this operation, click the checkmark icon on the top panel to apply all operations.
11. The following dialog box will appear asking for confirmation that all pending operations have been applied. Click the Apply button when you are confident in your choice.
The formatting process will begin:
You will be notified when operations are 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 either the command line or the user interface to format the USB drive after unmounting it. GParted’s powerful partition editing tool will also help you format your drive based on a long list of available file types.
How to format a USB drive in Ubuntu