Formatting a USB drive in Ubuntu using Terminal commands is much easier as formatting it in Windows systems. Some of the Ubuntu users are not familiar with terminal commands. This tutorial will help Ubuntu (Linux) users with the simple steps of USB flash drive formatting via command line.
Step 1 – Attach USB to System
Insert a USB drive into your system and identify your USB drive correctly. This is the step you need to take care, because you may format the wrong disk if not correctly identify your disk.
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/tecadmin
Now, You can see that the USD drive is attached as /dev/sdc1 device. Which is mounted on /media/tecadmin.
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
Similarly, you can format USB Flash drive with any required file system.
In this tutorial, you have learned to format USB drive on Linux system via command line interface.