How do you format a USB drive in Linux?

Answer:

First, you "unmount" it, but leave it plugged in. This is the equivalent of "Safely Remove Device" in Windows. you can unmount it using the command

umount /dev/sdx

"x" can be any letter, but it will usually be "f" for the first Flash drive plugged in. You can view the mounted devices by using the command

mount

This will return a result like:

/dev/sdf on /media/disk type vfat (rw,nosuid,nodev,uhelper=hal,uid=1000,codepage=437,iocharset=utf8)

for the Flash drive.

To format it, execute the command

mkfs.vfat /dev/sdx

You can then remount the device.

First answer by Idisjunction. Last edit by Idisjunction. Contributor trust: 804 [recommend contributor recommended]. Question popularity: 3 [recommend question].