Sometimes we need to format our USB key because its not showing properly formatted, this happen to me several times. Now the question is how to format your USB drive in Linux ? do we format it from GUI or terminal ?.

In this post I will show you how to format USB drive in Linux via Terminal. Once you know how to format USB drives from terminal, you will know it is very easy and pretty handy. Just follow these easy steps to format your USB in linux via terminal.

Step 1

Insert your usb drive to your linux PC and Open your terminal.

Step 2

Check your usb it is connected or not by using the command below

$ df

Now take note which drive you wish to format. In this tutorial, the name of drive I will going to format is under the path /dev/sdc1 with label USB_NAME 

Step 3

Before formatting umount the drive by using the command below

$ sudo umount /dev/sdc1

Step 4

In this step I will format my drive to fat32, but you can change it to other format if you want to (I will explain this at the end of this step). So to format use this command :

$ sudo mkfs.vfat -n 'VOLUME-NAME' -I /dev/sdc1

So here is the explaination :


According to the man page mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. The device argument is either the device name (e.g. /dev/hda1, /dev/sdb2), or a regular file that shall contain the filesystem. The size argument is the number of blocks to be used for the filesystem.


(dot)vfat means format the drive to FAT32, to format to other formats just change the vfat like this : mkfs.ext4 (This will format to ext4 file system). Other formats are available are mkfs.ext2 , mkfs.ext3, mkfs.ntfs, mkfs.msdos, mkfs.xfs, mkfs.bfs, etc.


-n use to sets the volume name (label) for the file system. The default name is no label and the maximum character for the volume name is up to 11 characters long. You can change the volume label by change the VOLUME_NAME on the command.


It is use to the location of the device you want to format to, according to the man page ” It is typical for fixed disk devices to be partitioned so, by default, you are not permitted to create a filesystem across the entire device.

Step 5

Now after you write the command above, it is the time to execute the command, press the enter key, enter your root password, and check again your usb drive with df command after formatting.

Now you are done, and congratulations you has successfully format your usb pen drive.

Thats all for my tutorial with title How to Format USB Drive in Linux via Terminal , I hope this tutorial can be useful and help you to format your usb in linux. If you have some suggestion or you have the other methods to format your usb, just leave it on the comment below, Thank you !

Leave a Reply

Your email address will not be published. Required fields are marked *