How to format USB drive in Linux

Written by Administrator on Wednesday April 1, 2020

If USB drive is already mounted in your system, it will be impossible to format it. So, first of all we have to unmount it.

1. First, define how USB drive is mounted running following command

$ df -h


 

So, in my case 16 GB USB drive was mounted as /dev/sdb1

2. Unmount USB drive

Let's unmount chosen USB drive:

$ sudo umount /dev/sdb1

In case you have problem and system says, that device is busy, you can force umount:

$ sudo umount -f /dev/sdb1

and see the result:

$ sudo mkfs.ext4 /dev/sdb1


So, USB drive was unmounted. Now we can format it:

3. Format USB drive

To format FAT32, run:

$ sudo mkfs.vfat /dev/sdb1

To format NTFS:

$ sudo mkfs.ntfs /dev/sdb1

To format EXT4:

$ sudo mkfs.ext4 /dev/sdb1

Category: linux Tags: USB mkfs