Contents

Format usb drive for Windows from Linux

Contents

From time-to-time you will need to give format to an usb drive in your Linux system, for example to backup important files or just share data with a colleague. In this recipe I will show you the commands you could use in Debian/Ubuntu.

First start plugging the USB and then check where the system recognise it, for that use:

1
sudo dmesg

It will show you at the end of the report, in that locate the lines that says “usb” and “New USB device found”, below those oyu will find messages from other modules/drivers that says “sd” and between square brakts you will find the device name like “[sdb]” and below yu will find fro example “sdb: sdb1”, sbd1 is the name you are looking for.

Make sure is not mounted you can check it with:

1
sudo mount

you can dismount with:

1
sudo umount /dev/sdb1  # for this example

the tool we are going to use is mkfs, if is not installed in your system, you can execute sudo apt install dosfstools now you are ready to go, for the format execute:

1
2
3
sudo mkfs.vfat -c -n <drive_label> /dev/sdb1
or
sudo mkfs -t vfat -c -n <drive_label> /dev/sdb1

where:

  • -c : to check the device for bad blocks before building the file system
  • -n <drive_label> : to give your drive a label
  • -t : used only by mkfs specify the type of file system

Checking the drive after the format is done:

1
sudo dosfsck -vV /dev/sdb1

done! you have a new USB that you can use in windows and also in linux.

Buy me a Coffee
Hope you find this useful, if you have any question please visit my twitter @bigg_blog and if you have a couple of pounds buy me a coffee.
G