It happens now and then that we need to format a USB drive to change the file system, delete the data completely or eliminate a virus that has infected it. There are several ways to format a USB drive; we've listed a few of them in this article to see which one works for you. You can format a USB drive from the command line and 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 to format the USB as per the VFAT file system:
$ sudo mkfs.vfat /dev/sdb1
You will use the location 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
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 entering all the details.
The following Confirm Details dialog will open so you can confirm the formatting details. Please ensure you format the correct volume by looking at the location information. This will prevent you from formatting 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:
Installation
1. Open the Terminal through CTRL+ALT+T or your Ubuntu Dash.
2. Enter the following command 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.
Formatting the HD
4. 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 the 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 you want to format, right-click, and 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 to have a formatted USB drive with the specified file system.
After reading this article, you may have found a way to format your USB drive for better use. After you unmount, you can use both the command line and the user interface to format a USB drive. The powerful partition editing tool GParted will also help you format your drive based on a long list of file types.
Frequently Asked Questions about Formatting a USB Drive in Ubuntu
What file systems can I use to format my USB drive in Ubuntu?
Common file systems for USB drives in Ubuntu are FAT32 (good for compatibility with Windows and MacOS), NTFS (primarily for Windows compatibility but readable on MacOS), and ext4 (best for use exclusively with Linux systems).
Is it safe to format a USB drive in Ubuntu?
Yes, it's safe, but formatting will erase all data on the USB drive. Ensure you have backups of any important data before formatting.
How long does it take to format a USB drive in Ubuntu?
The time to format a USB drive can vary based on the drive's size and the chosen file system. Generally, it takes a few seconds to a few minutes.
Can I format a USB drive to use with both Windows and Ubuntu?
Yes, formatting the USB drive with the FAT32 file system provides good compatibility with both Windows and Ubuntu. However, FAT32 has a file size limit of 4GB. For larger files, consider exFAT or NTFS, though NTFS may have limited write capabilities on MacOS.
How do I know if my USB drive needs to be formatted?
If the USB drive is not recognized, shows errors when trying to access it, or you want to wipe the data and start fresh, formatting is recommended. Also, if you're switching operating systems (like from Windows to Ubuntu), formatting might be necessary.
Can formatting a USB drive in Ubuntu fix errors?
Formatting can resolve some issues related to file system errors or corruption. However, it won't fix physical damage to the USB drive.
What should I do if Ubuntu fails to format my USB drive?
Ensure the USB drive is properly connected and not physically damaged. Try a different USB port or computer. If it still fails, the drive may be physically damaged or beyond repair.
How do I unmount a USB drive before formatting in Ubuntu?
Before formatting, it's important to unmount the USB drive. In the Disks utility, select the USB drive and click the stop button to unmount it. Alternatively, use the umount command in the terminal followed by the device identifier, like:
sudo umount /dev/sdx1