You are here

Wanting to use USB thumb on openwrt router on mesh node LAN to provide services

1 post / 0 new
wa2ise
wa2ise's picture
Wanting to use USB thumb on openwrt router on mesh node LAN to provide services

I want to evolve my "services" from some html and image files flashed onto a few Openwrt routers I have connected to the LAN of my Aredn node.  Right now, the service html pages work, but it's not easy to change them, as flash memory space isn't freed up when you delete or update these files.  And there isn't that much room in flash anyway.  So, I heard that one can hook up a USB thumb drive to an OpenWRT router, and I'm attempting to do this.  But I'm stuc (I'm a hardware guy, but a n00b on software and firmware issues).  I did a SSH session to the modified router and:

I have a WRT54G v2 router I flashed with openwrt 10.03.1 and I did the hardware mod for a USB port.  My thumb drive uses a FAT file system.  And installed various software packages from the openwrt.org web site:
kmod-fs-ext2     2.4.37.9-1
kmod-fs-ext3     2.4.37.9-1
kmod-fs-hfs     2.4.37.9-1
kmod-fs-msdos     2.4.37.9-1
kmod-fs-nfs     2.4.37.9-1
kmod-fs-nfs-common     2.4.37.9-1
kmod-fs-ntfs     2.4.37.9-1
kmod-fs-vfat    2.4.37.9-1
kmod-ipt-core     2.4.37.9-1
kmod-scsi-core     2.4.37.9-1
kmod-usb-core     2.4.37.9-1
kmod-usb-net     2.4.37.9-1
kmod-usb-ohci     2.4.37.9-1
kmod-usb-storage     2.4.37.9-1
kmod-usb-uhci     2.4.37.9-1
kmod-usb2     2.4.37.9-1

I imagine some of the above are not necessary, and hopefully don't interfere with each other...

I did a dmesg (via a SSH connection into the router)

root@OpenWrt:~# dmesg
CPU revision is: 00029007
Primary instruction cache 8kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 4kB, 2-way, linesize 16 bytes.
Linux version 2.4.37.9 (jow@nd-build-02.linux-appliance.net) (gcc version 3.4.6 (OpenWrt-2.0
)) #12 Wed Dec 21 03:33:39 CET 2011
Determined physical RAM map:
memory: 01000000 @ 00000000 (usable)
On node 0 totalpages: 4096
zone(0): 4096 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs,jffs2 init=/etc/preinit noinitr
d console=ttyS0,115200
CPU: BCM4712 rev 1 at 200 MHz
Using 100.000 MHz high precision timer.
Calibrating delay loop... 197.83 BogoMIPS
Memory: 14232k/16384k available (1457k kernel code, 2152k reserved, 100k data, 84k init, 0k
highmem)
Dentry cache hash table entries: 2048 (order: 2, 16384 bytes)
Inode cache hash table entries: 1024 (order: 1, 8192 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 4096 (order: 2, 16384 bytes)
Checking for 'wait' instruction...  unavailable.
POSIX conformance testing by UNIFIX
PCI: Initializing host
PCI: Fixing up bus 0
PCI: Fixing up bridge
PCI: Setting latency timer of device 01:00.0 to 64
PCI: Fixing up bus 1
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
Registering mini_fo version $Id$
devfs: v1.12c (20020818) Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
squashfs: version 3.0 (2006/03/15) Phillip Lougher
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled
ttyS00 at 0xb8000300 (irq = 3) is a 16550A
ttyS01 at 0xb8000400 (irq = 3) is a 16550A
b44.c:v0.93 (Mar, 2004)
PCI: Setting latency timer of device 00:02.0 to 64
eth0: Broadcom 47xx 10/100BaseT Ethernet 00:12:17:ac:8e:95
Physically mapped flash: Found an alias at 0x400000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0xc00000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1000000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1400000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1800000 for the chip at 0x0
Physically mapped flash: Found an alias at 0x1c00000 for the chip at 0x0
cfi_cmdset_0001: Erase suspend on write enabled
0: offset=0x0,size=0x2000,blocks=8
1: offset=0x10000,size=0x10000,blocks=63
Using word write method
Flash device: 0x400000 at 0x1c000000
bootloader size: 262144
Physically mapped flash: Filesystem type: squashfs, size=0x1a99ba
Creating 5 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x003f0000 : "linux"
0x000bd400-0x00270000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x003f0000-0x00400000 : "nvram"
0x00270000-0x003f0000 : "rootfs_data"
sflash: found no supported devices
Initializing Cryptographic API
IEEE 802.2 LLC for Linux 2.1 (c) 1996 Tim Alpaerts
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 1024 bind 2048)
Linux IP multicast router 0.06 plus PIM-SM
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NET4: Ethernet Bridge 008 for NET4.0
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Mounted devfs on /dev
Freeing unused kernel memory: 84k freed
diag: Detected 'Linksys WRT54G/GS/GL'
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
roboswitch: Probing device eth0: No Robo switch in managed mode found, phy_id = 0xffffffff
roboswitch: Probing device eth1: No such device
roboswitch: Probing device eth2: No such device
roboswitch: Probing device eth3: No such device
SCSI subsystem driver Revision: 1.00
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
Journalled Block Device driver loaded
PCI: Setting latency timer of device 00:04.0 to 64
usb-ohci.c: USB OHCI at membase 0xb8004000, IRQ 2
usb-ohci.c: usb-00:04.0, PCI device 14e4:4716
usb.c: new USB bus registered, assigned bus number 1
hub.c: USB hub found
hub.c: 2 ports detected
uhci.c: USB Universal Host Controller Interface driver v1.1
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
hub.c: new USB device 00:04.0-1, assigned address 2
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor:           Model: USB Flash Memory  Rev: 5.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 4028416 512-byte hdwr sectors (2063 MB)
sda: Write Protect is off
Partition check:
/dev/scsi/host0/bus0/target0/lun0: p1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
mini_fo: using base directory: /
mini_fo: using storage directory: /overlay
mtdblock: erase of region [0x0, 0x10000] on "nvram" failed
jffs2.bbc: SIZE compression mode activated.
b44: eth0: Link is up at 100 Mbps, full duplex.
b44: eth0: Flow control is off for TX and off for RX.
There is already a switch registered on the device 'eth0'
roboswitch: Probing device eth1: No such device
roboswitch: Probing device eth2: No such device
roboswitch: Probing device eth3: No such device
eth0.0: add 01:00:5e:00:00:01 mcast address to master interface
eth0.1: add 01:00:5e:00:00:01 mcast address to master interface
eth0.0: dev_set_promiscuity(master, 1)
device eth0 entered promiscuous mode
device eth0.0 entered promiscuous mode
br-lan: port 1(eth0.0) entering learning state
br-lan: port 1(eth0.0) entering forwarding state
br-lan: topology change detected, propagating
PCI: Setting latency timer of device 00:01.0 to 64
PCI/DMA
wl0: wlc_attach: chiprev 1 coreunit 0 corerev 7 cccap 0x4876a maccap 0x0 band 2.4G, phy_type
2 phy_rev 2 ana_rev 2
wl0: Broadcom BCM4320 802.11 Wireless Controller 4.150.10.5
NTFS driver v1.1.22 [Flags: R/O MODULE]
CSLIP: code copyright 1989 Regents of the University of California
PPP generic driver version 2.4.2
ip_tables: (C) 2000-2002 Netfilter core team
ip_conntrack version 2.1 (5953 buckets, 5953 max) - 352 bytes per conntrack
uhci.c: USB Universal Host Controller Interface driver v1.1
usb.c: USB disconnect on device 00:04.0-1 address 2
USB device disconnected from the SCSI subsystem
hub.c: new USB device 00:04.0-1, assigned address 3
  Vendor:           Model: USB Flash Memory  Rev: 5.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 4028416 512-byte hdwr sectors (2063 MB)
sda: Write Protect is off
/dev/scsi/host0/bus0/target0/lun0: p1
USB device connected to the SCSI subsystem
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 3
usb.c: USB disconnect on device 00:04.0-1 address 3
USB device disconnected from the SCSI subsystem
hub.c: new USB device 00:04.0-1, assigned address 4
  Vendor:           Model: USB Flash Memory  Rev: 5.00
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 4028416 512-byte hdwr sectors (2063 MB)
sda: Write Protect is off
/dev/scsi/host0/bus0/target0/lun0: p1
USB device connected to the SCSI subsystem
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 4
usb.c: USB disconnect on device 00:04.0-1 address 4
USB device disconnected from the SCSI subsystem
hub.c: new USB device 00:04.0-1, assigned address 5
scsi1 : SCSI emulation for USB Mass Storage devices
  Vendor: SanDisk   Model: Cruzer            Rev: 1100
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi1, channel 0, id 0, lun 0
SCSI device sda: 7821312 512-byte hdwr sectors (4005 MB)
sda: Write Protect is off
/dev/scsi/host1/bus0/target0/lun0: p1
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 5
root@OpenWrt:~#

So it looks like the system is seeing my thumb drive (I can see my plugging and unplugging various thumb drives above), but I haven't figured out where I can go (directory path) to look at the files on this thumb drive.  In the SSH session, I can't find the /dev/sda1 directory or where /home is located.  These are directories, yes?  And is vfat good for thumb drives that use a FAT system? 

Here's the "mount points-mount entry" info at the luci web page of the router

General settings
Device  /dev/sda1
mount point  /home
file system  vfat
run filesystem check  (yes)

What I'm hoping to be able to do is access say image files or html files from a browser on a computer on the same network this router is on.  Like
192.168.1.115:80/directorypath/example.html
and have it show up in the browser like a web page.

Thanks in advance, I did lots of searching, but didn't find the clues I need...

Someone suggested doing a 'mount':

This is what I get when I say "mount" in a SSH session:

root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /overlay type jffs2 (rw)
mini_fo:/overlay on / type mini_fo (rw)
none on /proc/bus/usb type usbfs (rw)
root@OpenWrt:~#

When I do

root@OpenWrt:~# mount /dev/sda1 /home -t vfat

I get

root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /dev type devfs (rw)
none on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw)
/dev/mtdblock/4 on /overlay type jffs2 (rw)
mini_fo:/overlay on / type mini_fo (rw)
none on /proc/bus/usb type usbfs (rw)
root@OpenWrt:~#

Looks the same (unless I missed something).  Anyway, I'm clueless as to what any of this means...  sad 

What command in SSH would I say to see a list of the files and directories on the thumb drive?  Assuming no configuration or such errors above

again TIA.   What I'm looking for is where I'd find files on the USB thumb drive, and in turn what path I'd use for an advertised service in the Aredn node. 

[MODERATOR: moved to ragchew forum]

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer