Formatting a USB Memory Stick

You can partition and format a Linux filesystem on a USB data stick using the following sequence of commands. First, you need to identify which device is your USB stick - the easiest way is probably to remove it if it is plugged in and then reconnect it. This will generate some messages about the device in the system messages file. View the last few lines to identify your device.

cat /var/log/messages

Your device will be named something like sda1, sdd1, etc. The next step is to create a partition on the stick.

sudo fdisk /dev/device-name

Now, create a filesystem using mkfs.

sudo mkfs -t vfat /dev/device-name

Now you need to create a folder as a mount point for the device.

mkdir mount-point

Finally, you can now connect the device to its mount point:

sudo mount /dev/device-name mount-point