Thursday, 29 December 2011

How to format pen drive from terminal in Ubuntu


Many times it happens that your pen drive or memory cards does not formatted from file manager so you have to format it from terminal. In this tutorial, it is shown that how to format pen drive or any other hard-disk or memory card from terminal using commands in Ubuntu.

This video gives you a complete idea of how to format pen drive from terminal and which commands you have to type.


I also attached the screenshots of this commands from terminal window step by step.


[1]  First of all type the below command for know the name of your pen 
       drive or memory card. [here | (pipe) operator is used which is given 
       above your enter key in most of keyboards.]  

       dmesg | tail

Or you can use the following command as above will not be work on some system.

       fdisk -l





[2]  Then unmount your pen drive using the following command.

       sudo umount /dev/sdb1

And enter your password.



[3]  Then enter the following command to format your pen drive with 
        FAT32 partition.


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

Your pen drive is now formatted and ready to use.


41 comments:

  1. This is most needed thing for the desktop user. Thanks for this information

    ReplyDelete
  2. thanks dude..............

    ReplyDelete
  3. it's Awesome.....
    i can't format my p.d before seen your blog.
    Than'x...

    ReplyDelete
  4. it's Awesome....
    i can't format my P.D before seen your blog.
    Than'x ....

    ReplyDelete
  5. What about doing it in GUI. I think its easier than this

    ReplyDelete
    Replies
    1. it does not format your drive to fat32, it just delete your data . . .

      Delete
  6. Thanks much!! it solved my problem

    ReplyDelete
  7. Nice Post Dude.... .. Ur trick got the ting get in2 wrk.. Thankz a lot Buddy.. :)

    ReplyDelete
  8. good work

    if any use find difficulty then view this video https://www.youtube.com/watch?v=z6TEh762Vec


    again great work . and i like the screen shots it makes thing easier .

    ReplyDelete
    Replies
    1. thank you . . .
      btw video is very informative . . .

      Delete
  9. Thanks. It was really needed.

    ReplyDelete
  10. thnks!!it's working..

    ReplyDelete
  11. my pd doesnot has any password...
    and pressing just enter
    it shows sorry,try again i.e. incorrect password

    ReplyDelete
    Replies
    1. it asks for your password of the user in which you logged in not pendrive password

      Delete
  12. THanks a lot author....!!!
    Author = daksh bhatt

    ReplyDelete
  13. It is not working, It is showing message "mkfs.vfat: unable to open /dev/sdb1: Read-Only file system

    ReplyDelete
    Replies
    1. Are you using pen drive or any type of memory card? Just check that it doesn't contain any write protected switch.

      Many of sd card or pendrive have that small switch.

      Delete
  14. Nice article.. It really save my time.. Thanks for uploading this so clearly..

    ReplyDelete
  15. Thanks but replace dmesg | tail from fdisk -l
    which will work on all systems
    as dmesg | tail was not working in my system

    But You had done a good work...................
    Thank You

    ReplyDelete
    Replies
    1. Thank you for your suggestion, I made an edit of your remarks so others will be benefited.

      Delete
  16. neither 'fdisk -l' nor 'dmesg | tail' works on my ubuntu 12.04.. isn't 'df -h' a much better option?

    ReplyDelete
  17. Thanks,
    Very useful .. easy.. and to the point :)

    ReplyDelete