USB storage

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 05:58, 3 November 2006 (edit)
Alexanderott (Talk | contribs)
(Performance Testing)
← Previous diff
Revision as of 12:15, 31 December 2006 (edit) (undo)
CaScAdE (Talk | contribs)
m (Installation)
Next diff →
Line 1: Line 1:
= Installation = = Installation =
-# Install the folowing modules :+== Install USB Kernel modules ==
ipkg install kmod-usb-uhci // this is for USB 1.1 ipkg install kmod-usb-uhci // this is for USB 1.1
Line 8: Line 8:
ipkg install kmod-usb-storage ipkg install kmod-usb-storage
-# For DD-WRT v23 or below, add the follwing script to startup. It executes on every reboot all *.startup scripts located in /jffs/etc/config/+== Create a startup sript that laods the modules ==
 + 
 +Create a file, usb.startup in /jffs/etc/config/ directory
 + 
 + ~ # mkdir /jffs/etc/config
 + ~ # vi /jffs/etc/config/usb.startup
 + 
 +that contains this (press i once for insert mode):
 + 
 + #!/bin/sh
 + insmod /jffs/lib/modules/2.4.30/usbcore.o
 + insmod /jffs/lib/modules/2.4.30/ehci-hcd.o
 + insmod /jffs/lib/modules/2.4.30/scsi_mod.o
 + insmod /jffs/lib/modules/2.4.30/usb-storage.o
 + # remove the dash (#) from the line below if you use USB 1.1
 + #insmod /jffs/lib/modules/2.4.30/uhci.o
 + insmod /jffs/lib/modules/2.4.30/sd_mod.o
 + 
 +vi is ended using "ESC" and then :wq
 + 
 +make the script executable:
 + 
 + chmod +x /jffs/etc/config/usb.startup
 + 
 +=== For DD-WRT v23 SP1 or below ===
 +add the follwing script to startup. It executes on every reboot all *.startup scripts located in /jffs/etc/config/
console mode console mode
Line 25: Line 50:
done done
-A startup script must be made to start usb drivers on every reboot. Create a file, usb.startup in /jffs/etc/config/ directory that contains this : 
- 
- #!/bin/sh 
- insmod /jffs/lib/modules/2.4.30/usbcore.o 
- insmod /jffs/lib/modules/2.4.30/ehci-hcd.o 
- insmod /jffs/lib/modules/2.4.30/scsi_mod.o 
- insmod /jffs/lib/modules/2.4.30/usb-storage.o 
- # remove the dash (#) from the line below if you use USB 1.1 
- #insmod /jffs/lib/modules/2.4.30/uhci.o 
- insmod /jffs/lib/modules/2.4.30/sd_mod.o 
This is it. Here's my dmesg from Asus WL-500gP This is it. Here's my dmesg from Asus WL-500gP
Line 55: Line 70:
hub.c: 2 ports detected hub.c: 2 ports detected
 +== kernel modules for filesystems ==
Now to access FAT/EXT/XFS partitions you must install Now to access FAT/EXT/XFS partitions you must install
ipkg install kmod-vfat ipkg install kmod-vfat
Line 61: Line 77:
ipkg install kmod-xfs ipkg install kmod-xfs
-Add to /jffs/etc/config/usb.startup+=== autoload filesystem modules ===
 +Add to /jffs/etc/config/usb.startup (comment out lines you don't need to save memory)
# FAT # FAT
insmod /jffs/lib/modules/2.4.30/fat.o insmod /jffs/lib/modules/2.4.30/fat.o
insmod /jffs/lib/modules/2.4.30/vfat.o insmod /jffs/lib/modules/2.4.30/vfat.o
#XFS #XFS
- insmod /jffs/lib/modules/2.4.30/xfs.o+ #insmod /jffs/lib/modules/2.4.30/xfs.o
 + #EXT2
 + #insmod /jffs/lib/modules/2.4.30/ext2.o
 + #EXT2
 + #insmod /jffs/lib/modules/2.4.30/ext3.o
 + 
Now dmesg should show (The example below is from a 80 GB HD) Now dmesg should show (The example below is from a 80 GB HD)
Line 74: Line 96:
/dev/scsi/host0/bus0/target0/lun0 /dev/scsi/host0/bus0/target0/lun0
 +== Multislot card reader ==
In order to use a multislot card reader, you must add the following parameter to the scsi_mod in the file /jffs/etc/modules.d/60-usb-storage: In order to use a multislot card reader, you must add the following parameter to the scsi_mod in the file /jffs/etc/modules.d/60-usb-storage:
scsi_mod max_scsi_luns=8 scsi_mod max_scsi_luns=8
-== Usage ==+= Usage =
-=== Mounting ===+== Mounting ==
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
-=== Performance Testing ===+== Performance Testing ==
With help of the hdparm package you could test your performance. With help of the hdparm package you could test your performance.
On an Asus WL-500gP(remium) without overclocking you will get On an Asus WL-500gP(remium) without overclocking you will get
Line 95: Line 118:
Please note overclocking wouldn´t get you significant more performance on Asus WL-500gP(remium) Router. Please note overclocking wouldn´t get you significant more performance on Asus WL-500gP(remium) Router.
-=== Listing Contents ===+== Listing Contents ==
ls -l /mnt ls -l /mnt

Revision as of 12:15, 31 December 2006

Contents

Installation

Install USB Kernel modules

 ipkg install kmod-usb-uhci // this is for USB 1.1
 ipkg install kmod-usb-core
 ipkg install kmod-usb2
 ipkg install kmod-usb-storage

Create a startup sript that laods the modules

Create a file, usb.startup in /jffs/etc/config/ directory

~ # mkdir /jffs/etc/config
~ # vi /jffs/etc/config/usb.startup

that contains this (press i once for insert mode):

#!/bin/sh
insmod /jffs/lib/modules/2.4.30/usbcore.o
insmod /jffs/lib/modules/2.4.30/ehci-hcd.o
insmod /jffs/lib/modules/2.4.30/scsi_mod.o
insmod /jffs/lib/modules/2.4.30/usb-storage.o
# remove the dash (#) from the line below if you use USB 1.1
#insmod /jffs/lib/modules/2.4.30/uhci.o
insmod /jffs/lib/modules/2.4.30/sd_mod.o

vi is ended using "ESC" and then :wq

make the script executable:

 chmod +x /jffs/etc/config/usb.startup

For DD-WRT v23 SP1 or below

add the follwing script to startup. It executes on every reboot all *.startup scripts located in /jffs/etc/config/

 console mode
 > ~ # nvram set rc_startup="
 > for I in `/bin/ls /jffs/etc/config/*.startup`
 > do
 >    sh $I &
 > done
 > "
 > ~ # nvram commit
 >
 web interface mode
 for I in `/bin/ls /jffs/etc/config/*.startup`
   do
     sh $I &
 done


This is it. Here's my dmesg from Asus WL-500gP

 dmesg
 SCSI subsystem driver Revision: 1.00
 Initializing USB Mass Storage driver...
 usb.c: registered new driver usb-storage
 USB Mass Storage support registered.
 uhci.c: USB Universal Host Controller Interface driver v1.1
 PCI: Enabling device 01:03.0 (0000 -> 0001)
 uhci.c: USB UHCI at I/O 0x100, IRQ 2
 usb.c: new USB bus registered, assigned bus number 2
 hub.c: USB hub found
 hub.c: 2 ports detected
 PCI: Enabling device 01:03.1 (0000 -> 0001)
 uhci.c: USB UHCI at I/O 0x120, IRQ 2
 usb.c: new USB bus registered, assigned bus number 3
 hub.c: USB hub found
 hub.c: 2 ports detected

kernel modules for filesystems

Now to access FAT/EXT/XFS partitions you must install

 ipkg install kmod-vfat
 ipkg install kmod-ext2
 ipkg install kmod-ext3
 ipkg install kmod-xfs

autoload filesystem modules

Add to /jffs/etc/config/usb.startup (comment out lines you don't need to save memory)

 # FAT
 insmod /jffs/lib/modules/2.4.30/fat.o
 insmod /jffs/lib/modules/2.4.30/vfat.o
 #XFS
 #insmod /jffs/lib/modules/2.4.30/xfs.o
 #EXT2
 #insmod /jffs/lib/modules/2.4.30/ext2.o
 #EXT2
 #insmod /jffs/lib/modules/2.4.30/ext3.o


Now dmesg should show (The example below is from a 80 GB HD)

 Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
 SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB)
 Partition check:
 /dev/scsi/host0/bus0/target0/lun0

Multislot card reader

In order to use a multislot card reader, you must add the following parameter to the scsi_mod in the file /jffs/etc/modules.d/60-usb-storage:

scsi_mod max_scsi_luns=8

Usage

Mounting

mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt

Performance Testing

With help of the hdparm package you could test your performance. On an Asus WL-500gP(remium) without overclocking you will get

hdparm -tT /dev/scsi/host0/bus0/target0/lun0/part2
Timing cached reads:   188 MB in  2.04 seconds =  92.16 MB/sec
Timing buffered disk reads:   24 MB in  3.19 seconds =   7.52 MB/sec


Please note overclocking wouldn´t get you significant more performance on Asus WL-500gP(remium) Router.

Listing Contents

ls -l /mnt

You can also add the above line to /jffs/etc/config/usb.startup to mount the partition on reboot

# multiple partitions
mkdir /tmp/usb/1
mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/usb/1
# list its contents
ls -l /tmp/usb/1
# second partition
mkdir /tmp/usb/2
mount /dev/scsi/host0/bus0/target0/lun0/part2 /tmp/usb/2
# list its contents
ls -l /tmp/usb/2