Although we have applications to format USB drives like “gparted” in Linux, knowing the process in the command line is useful when working remotely or working on computers with few resources. The steps as well as the process is compatible with any Linux distribution.
The USB Drive’s route in our file system is one of the most important points when we are formatting an usb drive. First, we must know the address that the Linux assigned the usb drive when mounted it. For that, we just need to write the df command on the terminal and tell us which drives are mounnted to the system. Normally Linux always assigns the letters “sdbX”, so if we only have one usb drive connected, it will be something like sdb1.
Once we have located the usb drive, we have to unmount it from the system before it can be formatted. In this case we have to write the following command in the terminal:
sudo umount /dev/sdb1
Now that the usb drive is unmounted, we have to write the following command in the terminal:
sudo mkfs.vfat -F 32 -n "usb_name" /dev/sdb1
The parameter -F 32 tells the system that the formatting must be done with the Fat32 file system. If we use the variable -n we have to indicate the name of the unit, it will appear each time we plug the usb drive in our computer.
To verify that the formatting process completed successfully:
sudo fsck /dev/sdb1
Once you have finished this process, we just have to mount the usb drive and we will see now the empty drive. Finally, to emphasize that we must know what is the usb drive route EXACTLY, because if we confuse drive names and put a wrong route, such as the route of the hard disk, we can delete the whole operating system.