"[Tutorial]Format USB Drive in Linux"

Published: Wed 20 July 2016

In content.

[Tutorial]Format USB Drive in Linux

To format your usb drive in linux, first you need to find out where the usb drive is mounted. To find out the device, type dmesg . At the very end of dmesg output, you will see some messages relating to the usb drive you have inserted just now. You should see something like this: sdX . Remember the drive. Before formatting your usb drive, you need to create partition table. To create partition table, run fdisk -l /dev/sdX where /dev/sdX is your usb drive. You will enter fdisk command mode. In command mode, type p and press enter. You will see /dev/sdX information with available partition table. Then type d and type 1 . To see the changes, type p again. Then type n and type p . Just enter all the way until you see command(m for help):``` again. Finally, typewto write changes to your usb drive and typeqto exit the program. Then, run this command :mkfs.vfat -n "USB Drive" -I /dev/sdX``` . You should see some output on your terminal window. Voila, you have formatted your usb drive.