Format usb drive for Windows from Linux

Format usb drive for Windows from Linux

linux usb format

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:

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:

sudo mount

you can dismount with:

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:

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 : 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:

sudo dosfsck -vV /dev/sdb1

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

Hope you find this useful, if you have any question please visit my twitter @bigg_blog and if you have a couple of pounds make a donation .

Add a comment

Previous Post Next Post