Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By busbarn at 2004-02-12 23:45
USB Card Reader HowTo
The purpose of this howto is to provide step by step instructions for the newbie trying to get his/her usb card reader or zip drive working. I will be describing command line steps. None of these operations are gui oriented. In all of the following steps, "$" will represent the user prompt while "#" will represent the root prompt. If there is no $ or #, then that is what the output should be. This howto will be divided into three parts:
These instructions should work with the 2.4.x and 2.6.1 kernels. The output that is posted in this howto is used with kernel 2.6.1. So open up your favorite terminal program and let's get started.
There are two important things that need to be enabled in the kernel: usb and scsi support. USB is needed because, well, that's the way your plugging the drive into your computer. SCSI is needed because the kernel will see your usb drive as an scsi device.
The first step is to compile your kernel with proper support. NOTE: I am not enabling anything as modules. For the sake of simplicity, everything is enabled with a yes.
Enable the following (bold titles are menu headers in menuconfig): 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 have USB2, enable EHCI. Try UHCI before OHCI. If later on in this how to the usb doesn't work, go back and switch it.
Exit, saving your changes.
If you are using kernel 2.4.x, type the following:
# make dep && make clean bzImage modules modules_install
If you are using 2.6, type the following:
# make && make modules_install
Copy your new kernel image to your boot directory and change your grub or lilo setup accordingly.
Now it's time to see if you configured your kernel properly. Make sure that your card reader is plugged in, preferably with a card in it. Once you are up and running, su into root again using your favorite console program. If you forgor how to do this, look back to step 1. ;)
First, lets see if the kernel sees your reader:
If you have something that looks like this, then you are in business. If not, go back to step one and make sure that everything is configured properly. Looking at the purple text, you can see that the kernel sees the drive at scsi2. Good. Now let's see which device the kernel has attached the drive to:
hub 2-0:1.0: new USB device on port 2, assigned address 2
scsi2 : SCSI emulation for USB Mass Storage devices
Vendor: General Model: USB Disk Drive Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sda: 493979 512-byte hdwr sectors (253 MB)
sda: assuming Write Enabled
sda: assuming drive cache: write through
Attached scsi removable disk sda at scsi2, channel 0, id 0, lun 0
Attached scsi generic sg2 at scsi2, channel 0, id 0, lun 0, type 0
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
If you can find something that looks like this with the dmesg command, then you are sitting pretty. This is not the only output of dmesg, so you will have to look through it to find what you want. This tells us that the kernel has assigned your usb drive to device sda1. Yours might say sda4, sdb1, sdc1, etc. Make note of what it says, your going to need it!
We need to make a directory in order to mount the drive. No, it isn't a horse.
# mkdir /mnt/USBdrive
#chmod 700 /mnt/USBdrive
I chmod because then you can't access the /mnt/USBdrive directory unless it is mounted. This may be confusing but when it comes to mounting, it's newbie friendly.
Now we need to update our /etc/fstab file. You can use any text editor, as long as you are still root. I prefer nano because it is newbie friendly! Add this line to the end of the file:
# nano -w /etc/fstab
/dev/sda1 /mnt/USBdrive auto user,rw,noauto 0 0
If you are using a digital camera card or some other windows oriented device, change auto to vfat.
Exit. Now's the moment of truth. As root, try:
# mount /mnt/USBdrive
if all goes well, exit and you are good to go.
A couple of issues you might run in to:
If you plug in or unplug other usb devices, the device label can change (especially if there is rebooting involved). So if it works, and you reboot and it doesn't, just dmesg to see what happened.
If your fs type entry in your fstab is wrong, (the whole auto, vfat thing) then you will get an error message. While this is unlikely, it is a possibility.
You should now be able to successfully setup a usb hard drive. IF you run in to some problems, there's a pretty good forum around here to ask for help! Have Fun!