11 April 2013

How to Mount, Unmount and Format USB pen drive using Terminal in Ubuntu/Linux Mint

29 comments

Q: How do I control my USB pen drive from terminal in Ubuntu/Linux Mint


Ans:

Mounting USB pen drive


1. In Ubuntu desktop, the USB pen drive will be detected and mounted automatically. In Ubuntu server command line terminal, a message will appear to notice you that some information about the USB pen drive that has been plug in or alternatively you can use fdisk command to check whether USB has been mounted or not. Here is sample

how to mount usb drive in ubuntu using terminal

1.a. If you get same output as mine then you can get mount location by using mount command

mount USB drive in Linux Mint

2. If Step 1 didn't work for you, then run dmesg command to identify the correct device name corresponding to the USB pen drive

$ dmesg

[19197.235469] sd 25:0:0:0: [sdb] Write Protect is off
[19197.235476] sd 25:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[19197.236972] sd 25:0:0:0: [sdb] No Caching mode page present
[19197.236982] sd 25:0:0:0: [sdb] Assuming drive cache: write through
[19197.242047] sd 25:0:0:0: [sdb] No Caching mode page present
[19197.242055] sd 25:0:0:0: [sdb] Assuming drive cache: write through
[19197.279672] sdb: sdb1 --> Device name
[19197.282401] sd 25:0:0:0: [sdb] No Caching mode page present
[19197.282406] sd 25:0:0:0: [sdb] Assuming drive cache: write through
[19197.282410] sd 25:0:0:0: [sdb] Attached SCSI removable disk
[19199.953227] usb 2-1.1: USB disconnect, device number 28

2.a. Create Mount Point

$ mkdir -p /media/usb

2.b. Mount USB pen drive

$ sudo mount /dev/sdb1 /media/usb

Unmounting USB pen drive


1. To unmount a USB device simply run the following command

$ sudo umount /dev/sdb1

OR

$ sudo umount /media/usb

NOTE: /media/usb is a mount point.

Formatting USB pen drive


1. First make sure that USB device is not mounted, if it is then unmount it.

2. Format USB device in fat32 format

$ sudo mkfs.vfat /dev/sdb1

Note: You can use mkfs.ext3 to format to ext3 filesystem.

Caution: Enter your device name correctly otherwise it will wip out your entire data.

3. Format and change the Label of the USB drive.

$ sudo mkfs.vfat -n 'sandeep' /dev/sdb1

That's it.
Enjoy :)


If You Liked This Post Please Take a Time To Share This Post

You May Also Like...

29 comments:

  1. What do you it will wip out all of my data? If I don't type the correct device will it format my whole hard disk drive or just the USB?

    ReplyDelete
    Replies
    1. Ya it can if dont put correct device name

      Delete
    2. You don't understand my questio

      Delete
    3. Very Nice and Informative Post. Thank admin for sharing such an amazing post.

      --->>Unable to Format Pen Drive? (Format Guaranteed)

      Delete
  2. May I have your email address am a newbie on linux and I need a guru like yourself to help me along the way.

    ReplyDelete
  3. This command $ sudo mkfs.vfat -n 'sandeep' /dev/sdb1 can be run if you are suduers rigth?Or can we run this as root?

    ReplyDelete
    Replies
    1. if we have root permission then only we can run this command

      Delete
  4. Thanks admin for this Informative Post. It may be useful for me.
    Promotional usb Flash Drives

    ReplyDelete
  5. It was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity! I will be back soon for updates.

    Working at college paper writing service

    ReplyDelete
  6. what should i do if again same error occur after running dmesg command ,here sdb1 shows but after mount it error message sdb1 does not exit found

    ReplyDelete
  7. Good article on mount and unmount pendrive online information.

    ReplyDelete
  8. I find some very helpful answers here. Having been also wondering on how to format USB pen drive using terminal in Ubuntu, I can say that this post has been of great assistance to me. Thanks a lot.
    Help Write My Coursework

    ReplyDelete
  9. Thanks for sharing. This is awesome.

    ReplyDelete
  10. I can now confidently mount, unmount, and format mu USB stick on my own using terminal on ubuntu/ linux mint and I would like to thank the author of this document for sharing this educative information with us. I have found a permanent solution to my USB disk issues. I can now transfer my research papers written by professional writers who are offering Literature Review Writing Help without worrying about my files being destroyed by a virus.

    ReplyDelete
  11. Your post have a very nice topic, and the content have been written in a way that one understands without any challenge. It would be very nice to see more of this kind of information once more. Great
    Decorativel wall bracket

    ReplyDelete
  12. Thanks admin for this Informative Post. It may be useful for me.
    Jio TV

    ReplyDelete
  13. What if we don't have root permission,will this trick work or not.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. I can now confidently mount, unmount, and format mu USB stick on my own using terminal on ubuntu/ linux mint

    ReplyDelete
  16. Here you can buy best pen dives. PTron Idrive High Speed 16GB 3 in 1 OTG Pen Drive Lightning Micro USB For IOS And Android SmartPhones.

    ReplyDelete
  17. Following the given manufacturer’s guidelines which mounting and unmounting USB drives helps in preventing them from spoiling. Many of the data corruption occurrences are associated with incorrect use of the USB drive. These guidelines will be very useful to me and to anyone else who is interested in using them. Application Essay for University Entrance

    ReplyDelete
  18. Tubemate 2.2.5 is a software to watch and download videos online on Youtube very quickly and conveniently. This application is provided completely free

    ReplyDelete
  19. Thank you very much. This is really a nice message.

    ReplyDelete
  20. Thanks admin for this Informative Post.

    ReplyDelete
  21. Great. These words can impress any one at any time. Thanks for this article. Amazing.

    ReplyDelete
  22. Well done. Thanks for sharing this article. This is something have to make cheer. Great work.

    ReplyDelete