Sunday, May 10, 2009

Format USB(flash drive) from terminal

Its quite easy to format a flash drive from terminal.
1st plug in your flash device, and open terminal.
NOTE: Flash drive should not be mounted. To unmount:


sudo umount /dev/sdb1

You will need to find out sdb1 by using df command. You can format drive to any format you want, ext3, fat32 etc. To find out your flash drive in dev, use this command in terminal:
df

Now lets say, your flash drive is sdb1.
So for FAT32:
sudo mkfs.vfat -n data /dev/sdb1

This will format sdb1 to fat32 and add a label "data".

For ext3:
sudo mkfs.ext3 -L data /dev/sdb1

This will format sdb1 to ext3 and add a label "data".

And that's it, you are done.

Last updated: 21-08-2012

4 comments:

wilduntu said...

Thanks!!
Worked fine!!

Unknown said...

I actually enjoyed reading through this posting.Many thanks.








Data Formatting Services

Anonymous said...

Do you need to make a label, or can I skip this?

M M Arif said...

@Anonymous, that's not necessary if you don't want.