Linux mkfs.vfat : Formatting USB Flash Disk Using Terminal
1. Insert your USB pen drive. Let kernel detect it.
2. Open Terminal. And show disk partition list by run the following commands :
$ sudo fdisk -l
Then you’ll got like similar output :
Disk /dev/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x7fe082c4 Device Boot Start End Blocks Id System /dev/sda1 * 2048 206847 102400 7 HPFS/NTFS/exFAT /dev/sda2 206848 116609191 58201172 7 HPFS/NTFS/exFAT /dev/sda3 116611072 362371071 122880000 7 HPFS/NTFS/exFAT /dev/sda4 362373118 976773119 307200001 5 Extended /dev/sda5 362373120 557685619 97656250 83 Linux /dev/sda6 960391168 976773119 8190976 82 Linux swap / Solaris /dev/sda7 557686784 960380927 201347072 83 Linux Partition table entries are not in disk order Disk /dev/sdb: 7803 MB, 7803174912 bytes 122 heads, 58 sectors/track, 2153 cylinders, total 15240576 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xc3072e18 Device Boot Start End Blocks Id System /dev/sdb1 * 8064 15240575 7616256 c W95 FAT32 (LBA)
3. Take a look at your flash disk partition. Usually under /dev/sdb
On this case, my flash disk is on /dev/sdb1 (see picture above)
4. Now format the partition using mkfs.vfat command :
$ sudo mkfs.vfat -n "TOSHIBA" -I /dev/sdb1
5. Thats’s all :D
NOTE : If you got “mkfs.vfat: command not found” output, you need to install it.
For Arch linux users :
$ pacman -S dosfstools ntfsprogs
* dosfstools gets you mkfs.vfat and mkfs.msdos
** ntfsprogs gets you mkfs.ntfs

