Format USB Drive in Ubuntu, Linux Mint [Quick Tip]

3 min


A quick tutorial on how to format a USB drive in Ubuntu.

Formatting a USB stick, Or any other USB device is a tricky business in Linux. It should have been a simple task for most users but there are some very annoying errors that you may face during format operation in Ubuntu. Here are the steps you need to follow to properly format a USB drive.

Steps to format USB in Ubuntu and other Linux

  • Plug-in the USB device. Wait for Ubuntu to automount the USB.
  • Open file manager and right-click on the USB device.
  • Click format.
Format from Context Menu
The format from Context Menu
  • Choose either slow, quick format method based on your preference.
Format Volume - Quick
Format Volume - Slow
  • If everything goes well for you, it should be formatted properly. If it is not, then you may get caught in the below error.
  • This error happens because the program was trying to write the wrong size blocks into the device.
Error Formatting Volume

At this point, Ubuntu in-built format under files is not sufficient to fix the USB. We need disk utility Gparted.

  • Install GParted by running the below command from the terminal in Ubuntu.
sudo apt-get install gparted
  • Once installed, launch GParted from the dash. Make sure to enter the administrator password when asked.
  • GParted should show the USB device as /dev/sdb or some other code as per your system. Once you have selected the USB drive, the entire partition table of your USB drive would be displayed.
GParted - Format Partitions
  • Select the partitions and delete them from the context menu. Once you have deleted all of them, click apply operations to write the changes to the USB.
GParted - Apply Operations
  • After all the operations are completed, you can see entire size of your USB is marked as unallocated.
  • Now create a new partition table from menu option Device -> Create Partition Table. Select type “msdos” and click apply.
GParted - Create partition table
  • Select the unallocated device and click New from the context menu to create a new partition and then click Add.
Gparted - Create new partition
  • Once the new partition is created, format the partition in your desire file system.
GParted - After Partition

If the above method of formatting a USB is not working Or you have messed up the partition table of your USB, then follow the below steps:

  • Open terminal. Run the below command, make sure to change “sdb1” as per your USB block device name before running the command.
sudo umount /dev/sdb1
sudo dd if=/dev/zero of=/dev/sdb1 bs=4MB
  • Keep patience, the above command would take a while. Then run the below command to format in fat or ext4 filesystem.
sudo mkfs.vfat /dev/sdb1
Or,
sudo mkfs.ext4 /dev/sdb1


Arindam

Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments