Linux and USB flash drives



This guide applies to kernel 2.6.

The kernel must be compiled with the right things
You must enable scsi support and USB support like below:
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

make

make modules_install

cp arch/i386/boot/bzImage /boot/vmlinuz

lilo

reboot

Did it find the USB device?
lsusb tells if the usb subsystem has found the usb device:
lsusb Bus 002 Device 006: ID 058f:6387 Alcor Micro Corp. Transcend JetFlash Flash Drive
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

What is the device name?
Search the logs to get the correct device name:
cat /var/log/messages | grep "SCSI removable"
Nov 20 15:23:21 jack kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
The kernel reports it attached the flash drive to the device /dev/sda.

If it’s the first time
Don’t forget to partition with for example fdisk and make a file system with mkfs.

Go ahead and mount
mount /dev/sda1 /mnt/flash