Page 1 of 1

Mounting A USB or Pen Drive In Linux mounting a Pen drive in linux Rate Topic: -----

#1 bsdninja  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 05-January 05

Posted 06 January 2005 - 04:42 PM

If you are having problems mounting a USB storage drive (hard drive or pen drive etc) first plug in the device and boot the computer. Watch your boot-up process to see if it detects the device. If so you probably won’t have to recompile your kernel.

First step is to go into your kernel’s source directory. Usually /usr/src/linux
If it is a recent kernel i.e. 2.6+ type:

Quote

make menuconfig


This will bring up a graphical menu of your kernel’s options, If you have to change anything here you must compile your kernel for the changes to take affect.

You want to enable scsi support and USB support like below if they are not already:

Device Drivers -------->
SCSI Device Support --------->
[*] legacy /proc/scsi/ support
<*> SCSI disk support
<*> SCSI generic support
USB Support -------------->
<*> Support for USB
[*] USB device filesystem
< > EHCI HCD (USB 2.0) support
< > OHCI HCD support
<*> UHCI HCD (most Intel and VIA) support
<*> USB Mass Storage support

If you experience problems with it still not seeing your drive try enabling EHCI or OHCI.

Now if you didn’t have to change anything here you can skip the compiling phase and go to mounting.

Next you need to compile. There are many ways to go about this so I'll just show you how I usually do it (recent kernels 2.6+). Type:

Quote

make (not necessary but I like to make sure)
(wait)
make modules
(wait)
make modules_install
(wait)
make bzImage
cp arch/i386/boot/bzImage /boot/linux-usb (you can name "linux-usb" what ever you want)


I will explain this next part for lilo if you use grub or something else your on your own here.

Edit your /etc/lilo.conf
and add:
        image=/boot/linux-usb (where linux-usb is the name of your image)
	label=name (where name is the name you want to pop up on lilo)
	read-only
	root=/dev/hda1 (where hda1 is what ever partition your using)


Now save and exit the lilo.conf file.
Now type "lilo" at the command line. It should say something about adding your image.
Reboot and make sure it all works.

*mounting*
If your kernel is all good and ready you should be able to mount
Go into your /dev directory
look for sdXX where XX is a leter and number ex: sda1.
Some distros will only make a dev for the devices you have and some will not. If there are a lot of sdXX's in there than just start with sda1 and try others if you have no luck.
Make a directory to mount your drive to ex:

Quote

mkdir /mnt/pendrive

Then mount it:

Quote

mount -t vfat /dev/sda1 /mnt/pendrive
where vfat is the type and sda1 is the dev for your drive.
the -t vfat is not allways nessisary but if it mounts and you have read or write errors then you need the -t vfat.
Well hopefully this helps someone. Oh don't forget to unmount using
umount /mnt/pendrive
Where /mnt/pendrive is the mount point.  If you dont unmount you will loose changes and risk messing up your partition.


Is This A Good Question/Topic? 0
  • +

Replies To: Mounting A USB or Pen Drive In Linux

#2 _byte_  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-January 05

Posted 10 January 2005 - 11:34 PM

Description is gud! Let me try that on my linux.
Was This Post Helpful? 0
  • +
  • -

#3 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Posted 02 June 2005 - 02:30 PM

Some flashdrives do not have partitions. And linux will attach them to /dev/sda
Was This Post Helpful? 0
  • +
  • -

#4 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Posted 08 June 2005 - 02:13 PM

Many digital cameras will attach to linux as a usb mass-storage device and will be accessible the same way as a flash drive.

Ex. My Nikon CoolPix 4600
Was This Post Helpful? 0
  • +
  • -

#5 siddu_sundaram  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-August 05

Posted 12 August 2005 - 12:08 AM

hi
i have a problem when i am using this command to load my usb it just gives me details that it is not able to load this file system what may be the problem pls helproot@ttyp0[knoppix]# mkdir /mnt/usb/
root@ttyp0[knoppix]# mount -t -vfat /dev/sda /mnt/usb
mount: fs type -vfat not supported by kernel
root@ttyp0[knoppix]#

this is the reply i get when i am typing the command
thanks :(
Was This Post Helpful? 0
  • +
  • -

#6 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Posted 12 August 2005 - 08:21 AM

Looks like you don't have vfat filesystem support compiled in your kernel.

Go to your source directory which should be
/usr/src/linux*.* ....

run:
make menuconfig

VFAT is found
In 2.6:
Goto Filesystems->DOS/FAT/NT Filesystems
Select VFat

In 2.4:
Goto Filesystems
Select DOS Fat fs support


Look here for more info on compiling and installing your kernel

If you need more help compiling your kernel, open up a new thread in the Operating Systems Forum.
Was This Post Helpful? 0
  • +
  • -

#7 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Posted 12 August 2005 - 09:02 AM

Thanx Nova Dragoon, helped me out quite a bit.
Was This Post Helpful? 0
  • +
  • -

#8 amos  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 146
  • Joined: 17-April 05

Posted 27 September 2005 - 11:27 AM

I've previously had all of the following attached to my box at one time or another as USB drives - pendrive, mp3 player (iRiver), camera, and mobile phone. Its probably 6 months or more since I upgraded to Slackware 10.1, for one reason or another I'd connected none of these recently. I've been using a 2.6.11 kernel which I compiled myself.(I might get round to slapt-get upgrading to 10.2 next weekend and compiling a newer kernel)

When I plugged my pendrive in the other month, so that I could copy something from it to my Linux box, I had the normal entries for it in fstab, but got an error when I tried to mount it.

Looking at dmesg after plugging the drive in gave me the following output:

usb 2-2.3: new full speed USB device using ehci_hcd and address 5
uba: device 5 capacity nsec 125952 bsize 512
uba: device 5 capacity nsec 125952 bsize 512
 /dev/ub/a: p1


It used to have /dev/sda or /dev/sda1 as its mount point. I couldn't find any references to what was going on on Google or Linuxquestions.org, and I tried all of the combinations of /dev/ub* I could think of so I left it. I've now found a reply to someones similar query which boils down to:

If you enable BLK_DEV_UB it completely disrupts the USB-storage driver. So what you have to do is disable it in:

->Device Drivers
->Block Devices

and deselect the option for:
Low Performance USB Block driver

this should re-enable the SCSI drivers (after recompiling and installing the kernel) and restore the pendrive/camera/mp3 player to /dev/sd*.

Hope this helps anyone who was having similar problems to myself.

Cheers
Amos
Was This Post Helpful? 0
  • +
  • -

#9 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Posted 27 September 2005 - 12:34 PM

CONFIG_BLK_DEV_UB:

This driver supports certain USB attached storage devices
such as flash keys.

Warning: Enabling this cripples the usb-storage driver.

If unsure, say N.

Symbol: BLK_DEV_UB [=n]
Prompt: Low Performance USB Block driver
Defined at drivers/block/Kconfig:354
Depends on: USB
Location:
-> Device Drivers
-> Block devices


These guys are to blame :P
* Copyright © 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
* Copyright © 2004 Pete Zaitcev (zaitcev@yahoo.com)
Was This Post Helpful? 0
  • +
  • -

#10 amos  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 146
  • Joined: 17-April 05

Posted 27 September 2005 - 02:02 PM

When I originally came across the problem at the end of July I did a search on both Google and linuxquestions and nothing showed up. It was only when I checked it out again today that I actually found anything.

I'm assuming it must have been enabled by default because the kernels on both my laptop and desktop had it enabled (and I configured both from scratch).

Cheers
Amos
Was This Post Helpful? 0
  • +
  • -

#11 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Posted 27 September 2005 - 08:57 PM

Thats weird, it shouldnt have been enabled by default, default is N in the config script?

Were you using Vanilla sources?
Was This Post Helpful? 0
  • +
  • -

#12 amos  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 146
  • Joined: 17-April 05

Posted 28 September 2005 - 10:10 AM

Quote

Thats weird, it shouldnt have been enabled by default, default is N in the config script?

Were you using Vanilla sources?


Maybe I did enable it then, it just seems strange that I enabled it twice separately on 2 different machines. I assumed I'd used vanilla sources but I might have used a Slackware 2.6.x .config file to get me started I can't actually remember (but I doubt if that was the cause as I can't see Patrick rendering users' pendrives unusable without a kernel recompile).

Basically I must have done it! :blush:

Twice! :stupid:

Cheers
Amos

This post has been edited by amos: 28 September 2005 - 10:11 AM

Was This Post Helpful? 0
  • +
  • -

#13 k.sangeeth  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 62
  • Joined: 27-July 07

Posted 02 August 2007 - 09:58 PM

-t option in mount was very helpful .. good work
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1