How to format pendrive or Memorycard or USB in ubuntu by Terminal

This article explains , how we can a format a pen drive or USB or memory card in ubuntu by using commands in terminal

Hello all. Today i tried to to format my pen drive by our file manager. But sometimes it fails to format. So we have to format it by terminal.

After plugging your device(usb or pen drive or memory card).

Open Terminal (cntrl +Alt + T)

type the command as 

$ dmesg | tail

output

[ 1749.108796] sd 9:0:0:0: [sdb] Write Protect is off
[ 1749.108813] sd 9:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1749.109803] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.109816] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.116895] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.116906] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.118911]  sdb: sdb1    –> Things to be noted
[ 1749.122785] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.122800] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.123771] sd 9:0:0:0: [sdb] Attached SCSI removable disk

Then Unmount your device by

$ sudo umount /dev/sdb1

Finally Enter this command to format Your device

$ sudo mkfs.vfat -n 'Ubuntu' -I /dev/sdb1

Note: Above command renames your pen drive as ubuntu(change to any name as you desire).

Thats it. Now plug out your device and plug in again to use . Your device is now formatted and ready to use now.

Happy coding!!!!

Leave a comment

(Note: Comments are moderated)