linux,ubuntu linux,ubuntu guide,linux technical documentation

Mount USB Drive in Ubuntu

by admin on Jul.29, 2010, under Ubuntu, Ubuntu 9.10, ubuntu 10.04, ubuntu 10.10, ubuntu 7.10, ubuntu 8.04, ubuntu 8.10, ubuntu 9.04

Automount

In ubuntu storage devices that are plugged into the system mount automatically and place an icon on your desktop, often called “disk” and as more drives are added, you can get “disk-1″ and so on. The folder disk create under /media folder. If we give the command

#fdisk -l

It mounted on new device sdb, sdc etc

To have a program automatically start when you plug in a device, go to System->Preferences->Removable Drives and Media.

Another one method is Open file browser select the menu Edit/preferences/media tab There you can select what happens when media is inserted. For example we need to turnoff audio CD auto play

CD audio “can do nothing” or “ask what to do” or “open folder”

Then Right Click the Device select Unmount for safely remove.

Command Line Mount


Sometimes devices don’t automount, in which case you should try to manually mount it.  Most flash drives are FAT16 or FAT32 and most external hard disks are NTFS.
Create Mount Point
sudo mkdir /media/Disk

Then mount the USB using the below command, Lets assume sdb1 is device, For FAT 32
sudo mount -t vfat /dev/sdb1 /media/Disk -o uid=1000,gid=100,utf8,dmask=027,fmask=137

The options following the “-o” allow your user to have ownership of the drive, and the masks allow for extra security for file system permissions. If you don’t use those extra options you may not be able to read and write the drive with your regular username.
For NTFS
sudo mount -t ntfs-3g /dev/sdb1 /media/Disk

Command for Unmount the Device

sudo umount /dev/sdb1 or sudo umount /media/Disk

Pmount
which allows unprivileged users to mount drives as if they were using sudo, even without an entry in /etc/fstab
For installing
#sudo apt-get install pmount
Example
pmount /dev/sdb1 test
This will mount the device /dev/sdb1 at /media/test
Prevent User access on USB Drive
For preventing the particular user access
System->Administration->User and Groups, choose the user, click on “Properties”, then go to the “User Privileges” tab.
Uncheck the options  “Access external storage devices automatically”.
Use full commands
lsusb – list the usb devices
dmesg – When you encounter problems with USB devices, the first thing to do is to check the latest debug information generated from the kernel just after you plug in your device and/or just after you encounter the problem.
Stop ubuntu from creating shortcuts of Harddisk, USB in Desktop
Open the terminal or press alt+f2
Type
gconf-editor
Navigate to apps — nautilus — Desktop. Uncheck Volumes_visible check-box in right pane.
:, , , , , ,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...