The usb-storage Linux kernel module is used for accessing all USB devices that are accessed as filesystems. For example, a usb connected hard drive, a flash card reader, and even some digital cameras.
In most cases, where a single USB storage device is connected, the data can be accessed using a variation on the following script, which I use for mounting a Sandisk flash card reader:
#!/bin/sh /sbin/modprobe -d usb-storage mkdir -p /mnt/sandisk mount -v -t vfat /dev/sda1 /mnt/sandisk /bin/ls --color -aR /mnt/sandisk
And when you are through:
#!/bin/sh
if [ `pwd` = "/mnt/sandisk" ]; then
cd ~
fi
umount -v -d /mnt/sandisk
rmdir /mnt/sandisk
For sanity's sake, you should replace the word sandisk with something that describes your USB storage device to you... for example jumpshot, or crummy_flash_reader.
There are some really brain damaged BIOS's that just refuse to cooperate, and hence the required /dev/sd* never appears.
This may be handled by running the following script at bootup:
~~~snip~~~
#!/usr/local/bin/tclsh8.4
# WRITE THIS SCRIPT TO A FILE NAMED pokeScsi
# and place it in root's path!
proc hit { args } {
catch { file attributes /dev/sd }
after 500
catch { file attributes [ lindex [ glob -nocomplain /dev/sd/* ] end ] }
after 500
catch { file attributes /dev/sda }
after 500
catch { file attributes [ lindex [ glob -nocomplain /dev/sda/* ] end ] }
after 500
catch { file attributes /dev/sda1 }
after 500 hit
}
hit
vwait eternally
~~~snip~~~
Run the script like this from /etc/rc.d/rc.local:
pkill -9 pokeScsi
pokeScsi &
If you do not understand what any of these commands do, I suggest you visit the [man pages]!
Phil,
I wanted to give a little input into the wiki pages on USB storage, in terms of what could go wrong. I followed the instructions on the page with my first smart card and things went fine. I confidently popped in a second smart card and when I tried to mount the card I got the error message: wrong file system, to many mounded blocks, etc.
Followup 08/06/2004:
I finally got around to finding out exactly what went wrong. The Lexar Media Jumpshot CF cardreader I have only reads USB enabled CF cards (There is a USB logo on USB enabled smart cards). Most new USB card readers can read all types of CF cards.
Smart cards and compact flash cards look just like drives from the computer's perspective, so you can partition and format these media at will using Linux:
Just do fdisk /dev/sda1 and create a partition of whatever type you want.
Then format it. For example, how about an ext2 filesystem on a compact flash card: mke2fs /dev/sda1. See man mkfs.
Smart cards and compact flash cards are designed to look exactly like drives from the hardware's perspective.
See also: http://inferno.slug.org/LDP-HOWTOS/Filesystems-HOWTO.html