How To Format USB Drive in Linux Command Line

Step 1 – Insert USB and Identify Volume

$ df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       28G    24G  2.3G  92% /
udev            1.4G   12K  1.4G   1% /dev
tmpfs           277M  1.2M  276M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.4G   34M  1.4G   3% /run/shm
/dev/sdc1      14.8G  1.4G  13.4G  10% /media/admin

Now, I have identified the drive /dev/sdc1, is my attached 16GB USB drive.

Step 2 – Format USB Drive in Linux

Whenever we attach a USB drive in Ubuntu, it automatically mounted to the system. We can not format any disk on Linux systems which are already mounted. So first un-mount /dev/sdc1 USB drive on your system.

$ sudo umount /dev/sdc1

Now, Use one of the following commands as per the file system you want. To format a USB drive, most of the users prefer VFAT and NTFS file systems because they can be easily used on the Windows operating system.

  • Format with vFat File System
    $ sudo mkfs.vfat /dev/sdc1
    
  • Format with NTFS File System
    $ sudo mkfs.ntfs /dev/sdc1
    
  • Format with EXT4 File System
    $ sudo mkfs.ext4 /dev/sdc1
    

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in