Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO USB Mass Storage Device and Gentoo :D
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5, 6, 7  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
pregopresto
n00b
n00b


Joined: 05 May 2003
Posts: 46

PostPosted: Mon May 12, 2003 9:06 pm    Post subject: HOWTO USB Mass Storage Device and Gentoo :D Reply with quote

HOWTO USB Mass Storage Device and Gentoo :D

I searched and asked and tried a long time. My 128-MB USB-Stick from Aldi (Medion) works now and here is the way how I got everything working.

I am using the Kernel 2.4.20 - gentoo-sources

Go to the kernel source directory and make the menu

Code:

cd /usr/src/linux
make menuconfig


Now we have to make sure first, that you have SCSI Support compiled in your Kernel. Please go to the menuitem

Code:

SCSI support  --->


and hit enter. Check out now, if the first entry, SCSI support is selected. If not compile it either into your kernel or compile it as module. I personally have it compiled into my kernel, but, of course, you can compile it as module as well. The module would be called scsi_mod later. Else you need the SCSI disk support. If you compile it as modul, it is called later sd_mod. If you compile them as modules, remember to load them later in the /etc/modules.autoload as well. The rest of the instructions are written like if the SCSI support is compiled staticly into your kernel.

Now we go to:

Code:

File systems --->


Please make sure that DOS FAT fs support and the subitems MSDOS fs support and VFAT (Windows-95) fs support are choosen as module.

Code:

<M> DOS FAT fs support
<M>   MSDOS fs support
< >     UMSDOS: Unix-like file system on top of standard MSDOS fs
<M>   VFAT (Windows-95) fs support


Now go back and change to

Code:

USB support --->


Compile support for USB as Module

Code:

<M> Support for USB


Depending on your motherboard you need either UHCI or OHCI support. Read your manual and the help entries for UHCI and OHCI to find out what you need. Else you need USB Mass Storage support, of course ;) .

Code:

<M>   UHCI (Intel PIIX4, VIA, ...) support

or
Code:

<M>   OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support

and, of course:
Code:

<M>   USB Mass Storage support




That's it I think! Exit and save configuration. Then compile and install the kernel as described in the Gentoo X86 Installation Guide and reboot your system with the new kernel.

You should be able now to load the folowing modules using modprobe

Code:

modprobe usbcore
modprobe usb-storage
modprobe vfat


Else you have to load either
Code:

modprobe usb-uhci

or
Code:

modprobe usb-ohci


Please remember to load the SCSI modules as well, if you compiled SCSI support as module, of course.

Code:

modprobe scsi_mod
modprobe sd_mod


When you see no error message plug in your USB-Stick and run

Code:

dmesg


. You should see something similar to

Code:

hub.c: new USB device 00:09.0-2, assigned address 3
usb-storage: act_altsettting is 0
usb-storage: id_index calculated to be: 47
usb-storage: Array length appears to be: 68
usb-storage: Vendor: JMTek
usb-storage: Product: USBDrive
usb-storage: USB Mass Storage device detected
usb-storage: Endpoints: In: 0xe55f7d40 Out: 0xe55f7d54 Int: 0xe55f7d68 (Period 255)
usb-storage: Found existing GUID 0c7600050000000000000000
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 3


Now create a mountdir and try to mount your USB stick:

Code:

mkdir /mnt/usbstick
mount -t vfat /dev/sda1 /mnt/usbstick


When you see no errors your USB-Stick should be installed correct. Open now the /etc/modules.autoload and add the modules to it.

Now you can optionally insert a new line to your /etc/fstab like

Code:

# MY USB STICK
 
 /dev/sda1               /mnt/stick      auto            noauto,user,exec     0 0



When you have KDE installed and you want a nice Icon on your Desktop then you can find some here or here.

I hope this Howto can help a bit.

Prego :)

------
Changelog
------
29.10.2003 Added FSTAB and SCSI things, else the OHCI stuff. Thanks to all users here in this forum... ;)


Last edited by pregopresto on Wed Oct 29, 2003 8:05 pm; edited 11 times in total
Back to top
View user's profile Send private message
sebest
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 163
Location: Paris - France

PostPosted: Tue May 13, 2003 12:52 am    Post subject: Reply with quote

An example entry for your fstab.
Code:

/dev/sda1               /mnt/memstick   vfat         user,noauto,umask=0077        0 0


This line allow any user to mount,umount the memstick and doesn't mount it automatically at boottime, because most of the time it's unplugged at boot time.

I also added the umask option, because i need it to be only accesible for my user, otherwise i couldn't stock my sshkeys on it and ssh-agent wouldn't accept my keys because of too opened permissions.

You can also add the option uid and/or gid if you want to force the owner of the files and the mountpoint of your memstick
(ex: user,uid=tom,gid=users)
_________________
--
Seb aka "Mr Est"


Last edited by sebest on Tue May 13, 2003 1:09 am; edited 1 time in total
Back to top
View user's profile Send private message
gschneider
Tux's lil' helper
Tux's lil' helper


Joined: 10 Apr 2002
Posts: 81
Location: Darmstadt, Germany

PostPosted: Tue May 13, 2003 1:02 am    Post subject: Reply with quote

sebest wrote:
I'm looking for mount options for vfat that allow to change the rights on it, because it defaults to something like 644, and it's too open to stock your ssh keys for example...


try umask (umask=077 will give only the mounter access)

---

don't forget scsi support when you add usb mass storage support (or you won't have any devices)
_________________
/(bb|[^b]{2})/
Back to top
View user's profile Send private message
sebest
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 163
Location: Paris - France

PostPosted: Tue May 13, 2003 1:11 am    Post subject: Reply with quote

gschneider wrote:
sebest wrote:
I'm looking for mount options for vfat that allow to change the rights on it, because it defaults to something like 644, and it's too open to stock your ssh keys for example...


try umask (umask=077 will give only the mounter access)

---

don't forget scsi support when you add usb mass storage support (or you won't have any devices)


thanx i also found this while reading the man of mount ;)
(sometimes i post too quickly)
_________________
--
Seb aka "Mr Est"
Back to top
View user's profile Send private message
pregopresto
n00b
n00b


Joined: 05 May 2003
Posts: 46

PostPosted: Tue May 13, 2003 6:43 am    Post subject: Reply with quote

Quote:

Code:

/dev/sda1               /mnt/memstick   vfat         user,noauto,umask=0077        0 0

'


I forgot to add that. I personally have the value "auto" instead of "vfat", as I personally run "mkreiserfs" over my stick, but my brother and my dad still have vfat. My entry for the stick in /etc/fstab is:

Code:

# MY USB STICK

/dev/sda1               /mnt/stick      auto            noauto,user,exec     0 0


Of course feel free to modify the options..... ;)

Prego :)
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Tue May 13, 2003 7:08 am    Post subject: Reply with quote

I had to have scsi-disk support and emulation b4 I could get mine to work.. just incase someone else can't either :)
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
carambola5
Apprentice
Apprentice


Joined: 10 Jul 2002
Posts: 214
Location: Madtown, WI

PostPosted: Tue May 13, 2003 8:58 am    Post subject: Re: HOWTO USB Mass Storage Device and Gentoo :D Reply with quote

pregopresto wrote:
...
That's it I think! Exit and save configuration. Then compile and install the kernel as described in the Gentoo X86 Installation Guide and reboot your system with the new kernel.


AFAIK, you don't need to reboot if all you do is add some modules. Simply do:
Code:
make dep && make modules modules_install

And I'm not even sure if the make dep is necessary.

Be aware that if you are modifying anything related to a star (ie: compiled in), you'll need to reboot for the changes to take effect. But if usbcore, usb-storage, usb-uhci, and vfat were previously unchecked and you add them as modules, there should be no need to reboot.
_________________
Get Firefox!

Proper Web Development

I'm done at 999.
Back to top
View user's profile Send private message
Crazor
Tux's lil' helper
Tux's lil' helper


Joined: 23 Apr 2003
Posts: 131

PostPosted: Sun May 18, 2003 7:49 pm    Post subject: Reply with quote

hi, i've got a noname mp3 player/usb stick. whenever i plug it in, dmesg says:
Code:
hub.c: new USB device 00:11.3-2, assigned address 2
usb.c: USB device 2 (vend/prod 0x66f/0x3410) is not claimed by any active driver.

the player is based on the stmp3410 from sigmatel and is supposed to work like a normal usb stick (i.e. usb mass storage device)
no idea whether it works under windoze w/o driver. they supplied a cdrom, but there seems to be only a small manager program that should simplify transfer to/from the stick. the manual says just plug in and use "removable device" via windoze exploder. so everything seems like mass storage

any suggestions?
p.s. using ac-sources (2.4.21-rcsomething)
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Sun May 18, 2003 10:14 pm    Post subject: Reply with quote

hmmm mine says
Quote:
hub.c: new USB device 00:02.1-1, assigned address 2
scsi2 : SCSI emulation for USB Mass Storage devices
Vendor: OTi Model: Flash Disk Rev: 1.11
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi2, channel 0, id 0, lun 0
SCSI device sda: 258048 512-byte hdwr sectors (132 MB)
sda: Write Protect is off
/dev/scsi/host2/bus0/target0/lun0: p1


it sounds like you don't have all the drivers you need. it knows it's there, so usb is fine, but you don't have something else.. hmmm.. did you add scsi disk support?
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 16108
Location: Colorado

PostPosted: Fri May 23, 2003 3:37 am    Post subject: Re: HOWTO USB Mass Storage Device and Gentoo :D Reply with quote

Overall, pretty good. I had a couple of issues.

Instead of usb-uhci, I had to use usb-ohci (found near usb-uhci). Also, I had to include "SCSI support --->", "SCSI disk supprt" which provides the module "sd_mod.o". I thought I already had this included, so it took me a few minutes to realize the problem.

Also, I recommend anyone not familiar with these devices to be patient waiting for data to finish writing. I copied some files over that appeared to be finished before the LED started flashing. The LED then flashed for a while, and finally stopped. For whatever reason, the writing seems to be delayed.
_________________
lolgov. 'cause where we're going, you don't have civil liberties.

In Loving Memory
1787 - 2008
Back to top
View user's profile Send private message
mr_neutron
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jan 2003
Posts: 124
Location: Germany

PostPosted: Fri May 23, 2003 11:25 am    Post subject: Reply with quote

Yes, the writing of data to the disk is delayed, but this is the default. It is only noticeable because these flash memory devices are so much slower than a hard disk.
If you want the data to be written instantly, add "sync" to the mount options in /fstab:
Code:

/dev/sda1               /mnt/usbflash      auto            noauto,user,exec,sync     0 0

This makes it really slow (on my cheap USB 1.1 flash memory, at least), so I rather omit this and wait a little longer after unmounting the device. On the other hand, with "sync" enabled you probably don't risk data corruption if you forget to unmount the device before unpluging it.

I am currently experimenting with mounting my /home partition from an ext2 formatted USB flash memory device, so I can share it between my Laptop and Desktop and don't have to sync files all the time. So far I have found it save to call "/bin/sync" (writes all pending data to disks) from .bash_logout, and unplug the device without unmounting it.
Back to top
View user's profile Send private message
karrots
n00b
n00b


Joined: 06 Mar 2003
Posts: 11
Location: Ogden, Ut

PostPosted: Fri May 23, 2003 4:02 pm    Post subject: Instead of modules.autoload Reply with quote

Another way instead of putting all of the modules for the USB in modules.autoload you can.

Code:
emerge sys-apps/hotplug

Code:
rc-update add hotplug default


Autoload or compile in USB core and then instead of the modules always being loaded the hotplug scripts take care of it.
Back to top
View user's profile Send private message
taskara
Advocate
Advocate


Joined: 10 Apr 2002
Posts: 3763
Location: Australia

PostPosted: Fri May 23, 2003 11:09 pm    Post subject: Reply with quote

here's your problem:

# USB support
# CONFIG_USB_STORAGE is not set

set this to "y"

also you may want to change the driver for your usb controller from a module to compiled directly in too

# USB support
CONFIG_USB_UHCI_ALT=y

save that,
Code:
make dep clean bzImage modules modules_install

Code:
 mount /boot

Code:
 mv /boot/bzImage /boot/bzImage.old

Code:
 mv arch/i386/boot/bzImage /boot

Code:
 shutdown -r now


then run dmesg and see if it's different, or check /dev/sda
_________________
Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer!
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 16108
Location: Colorado

PostPosted: Fri May 23, 2003 11:10 pm    Post subject: Reply with quote

mart_man00's problem has been split off to here.
_________________
lolgov. 'cause where we're going, you don't have civil liberties.

In Loving Memory
1787 - 2008
Back to top
View user's profile Send private message
toskala
Advocate
Advocate


Joined: 14 Dec 2002
Posts: 2080
Location: hamburg, germany

PostPosted: Fri Aug 01, 2003 3:03 pm    Post subject: Reply with quote

was following the howto, works fine, i just forgot adding scsi-disk support, after reading the posts i got enlightened :)

finally the stick works ;-)

cheerios
_________________
adopt an unanswered post
erst denken, dann posten
Back to top
View user's profile Send private message
kverastin
n00b
n00b


Joined: 27 Mar 2003
Posts: 10

PostPosted: Sun Aug 03, 2003 5:01 am    Post subject: Reply with quote

I'm assuming that this works for USB hard drives as well. Is there a way that I can change the format of the USB mass storage devices from vfat to something like reiserfs? (I'm talking about for USB hard drives, not memory sticks) I'm assuming you can because I don't know why you wouldn't be able to, just wondering if anybody has done this.
Back to top
View user's profile Send private message
Chris Finch
Tux's lil' helper
Tux's lil' helper


Joined: 10 Mar 2003
Posts: 106
Location: Darmstadt, Germany

PostPosted: Mon Aug 04, 2003 11:32 am    Post subject: Reply with quote

kverastin wrote:
I'm assuming that this works for USB hard drives as well.

It does. I used it in order to mount the archos usb disk drive of a friend.
Quote:
Is there a way that I can change the format of the USB mass storage devices from vfat to something like reiserfs? (I'm talking about for USB hard drives, not memory sticks) I'm assuming you can because I don't know why you wouldn't be able to, just wondering if anybody has done this.

I haven't done it, but I'm sure a "mkreiserfs /dev/sda1" will do that (that is assuming that sda1 is the device generated by the usb module and not your primary scsi disk :wink: ) Also, you shouldn't have it mounted while you create the file system and - of course - you will loose all data on your USB hd when you create a new fs). Furthermore, you won't be able to access your drive from most other OSs (sorry for all the banalities).

I had issues with 2.4.20 and usb, but 2.4.21 works great for me in that respect. I also endorse using the sync option for mount, with USB2.0 this is still way fast!

Final comment regarding the doc: you need either uhci or ohci, depending on your motherboard. For my ASUS P4PE it's uhci.
Back to top
View user's profile Send private message
Chris Finch
Tux's lil' helper
Tux's lil' helper


Joined: 10 Mar 2003
Posts: 106
Location: Darmstadt, Germany

PostPosted: Mon Aug 04, 2003 12:09 pm    Post subject: Reply with quote

mr_neutron wrote:

I am currently experimenting with mounting my /home partition from an ext2 formatted USB flash memory device, so I can share it between my Laptop and Desktop and don't have to sync files all the time. So far I have found it save to call "/bin/sync" (writes all pending data to disks) from .bash_logout, and unplug the device without unmounting it.


sounds rather scary to me, I wouldn't want to jeopardize my /home in that way. Have you tried net-misc/unison ? It's a very reliable and flexible, yet easy solution to keep your data in sync.
Back to top
View user's profile Send private message
mr_neutron
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jan 2003
Posts: 124
Location: Germany

PostPosted: Mon Aug 04, 2003 3:16 pm    Post subject: Reply with quote

Yes, Unison is a nice tool. I have given up the original idea quickly, instead I used rsync to keep my "/home"s in sync via the USB Memory (all automated with .bash_profile and .bash_logout).
However, my laptop recently died, so I do not have to sync any more :cry:

@ kverastin:
I don't have a USB hard drive, but you can handle a USB Memory stick just like a hard drive, even create multiple partitions on it and format them with different FS.
I tried reiserfs on my 128MB USB memory (just for fun). It works, but it is sloooow and you loose 33 MB for metadata.
Back to top
View user's profile Send private message
swingarm
l33t
l33t


Joined: 08 Jun 2002
Posts: 627
Location: Northern Colorado

PostPosted: Mon Aug 04, 2003 11:16 pm    Post subject: Reply with quote

Just to let people here know I compiled the following into the kernel and it works fine on my USB Pen Drive:
Code:

usbcore
usb-storage
usb-uhci
vfat

They don't have to be loaded as modules at least in my case.
Back to top
View user's profile Send private message
cryos
Retired Dev
Retired Dev


Joined: 08 Mar 2003
Posts: 242
Location: US

PostPosted: Tue Aug 05, 2003 9:19 am    Post subject: Reply with quote

Thanks for the guide - it helped me to get my SmartDisk multi memory card reader to work - at least for the Sony Memory Stick, I don't have the others :) Looking forward to trying to get my USB Flash Drive to work when it arrives too.
Back to top
View user's profile Send private message
sebo
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2003
Posts: 114
Location: Aix en Provence, FRANCE

PostPosted: Tue Aug 05, 2003 8:27 pm    Post subject: Reply with quote

Hi,

This post seems very good for me. However, after following the instructions (I recompiled the kernel with the provided options), modprobe could'nt locate the different modules:

modprobe usbcore
modprobe usb-storage
modprobe usb-uhci
modprobe vfat

...

Do I have to compile them apart? Or have I forgotten something in the kernel compile command?

Thanks... :?
_________________
Sébastien
Back to top
View user's profile Send private message
Chris Finch
Tux's lil' helper
Tux's lil' helper


Joined: 10 Mar 2003
Posts: 106
Location: Darmstadt, Germany

PostPosted: Tue Aug 05, 2003 8:50 pm    Post subject: Reply with quote

maybe you have forgotten make modules and make modules_install?
what is the output of
Code:
ls -R /lib/modules/`uname -r` |grep usb
and
Code:
ls -R /lib/modules/`uname -r` |grep vfat
?
If that doesn't find the modules (with an o extension, assuming you use a 2.4 kernel) then you haven't installed them correctly.
Back to top
View user's profile Send private message
sebo
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2003
Posts: 114
Location: Aix en Provence, FRANCE

PostPosted: Tue Aug 05, 2003 9:13 pm    Post subject: Reply with quote

I indeed did not compile the kernel using make modules and make modules_install commands....
That's now better.
However, here are two strange errors coming up when I "modprobe" usb-uhci and vfat...

Quote:

bash-2.05b# modprobe usb-uhci

Note: /etc/modules.conf is more recent than /lib/modules/2.4.20/modules.dep
/lib/modules/2.4.20/kernel/drivers/usb/usb-uhci.o: init_module: No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg
/lib/modules/2.4.20/kernel/drivers/usb/usb-uhci.o: insmod /lib/modules/2.4.20/kernel/drivers/usb/usb-uhci.o failed
/lib/modules/2.4.20/kernel/drivers/usb/usb-uhci.o: insmod usb-uhci failed

bash-2.05b# modprobe vfat
Note: /etc/modules.conf is more recent than /lib/modules/2.4.20/modules.dep
/lib/modules/2.4.20/kernel/fs/fat/fat.o: unresolved symbol load_nls_Rsmp_afd2e7ee
/lib/modules/2.4.20/kernel/fs/fat/fat.o: unresolved symbol load_nls_default_Rsmp_535f6428
/lib/modules/2.4.20/kernel/fs/fat/fat.o: unresolved symbol utf8_wcstombs_Rsmp_863cb91a
/lib/modules/2.4.20/kernel/fs/fat/fat.o: unresolved symbol unload_nls_Rsmp_



When I do the commands you asked, I got:
Quote:

bash-2.05b# ls -R /lib/modules/`uname -r` |grep usb
modules.usbmap
usb
/lib/modules/2.4.20/kernel/drivers/usb:
usb-ohci.o
usb-uhci.o
usbcore.o
/lib/modules/2.4.20/kernel/drivers/usb/storage:
usb-storage.o
36a16ffc
/lib/modules/2.4.20/kernel/fs/fat/fat.o: insmod /lib/modules/2.4.20/kernel/fs/fat/fat.o failed
/lib/modules/2.4.20/kernel/fs/fat/fat.o: insmod vfat failed

and

bash-2.05b# ls -R /lib/modules/`uname -r` |grep vfat
vfat
/lib/modules/2.4.20/kernel/fs/vfat:
vfat.o




Any ideas??? Thnaks Chris for your support.
_________________
Sébastien
Back to top
View user's profile Send private message
Chris Finch
Tux's lil' helper
Tux's lil' helper


Joined: 10 Mar 2003
Posts: 106
Location: Darmstadt, Germany

PostPosted: Tue Aug 05, 2003 9:37 pm    Post subject: Reply with quote

Sebastien: pheew, no idea. The good news is that your modules are now in place, but why trying to load them should give that error I don't know. One thing you can try is to plug in your usb-device before you boot up. Did you reboot or do an update-modules?

I have had crazy problems with 2.4.20 and usb, but since I installed a vanilla 2.4.21 everything works very well. As a last resort, you can try that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum