I am trying to set up a microSD card installed in a usb hspa modem as an external storage and use one of the partitions as pivot overlay.
Used Hardware:
Router: TP-Link MR3220
OpenWrt built: ATTITUDE ADJUSTMENT (Bleeding Edge, r32775)
HSPA modem: ZTE Vodafone K3765-Z + 2GB microSD card
I have installed all the prerequisites for USB storage including the needed stuff for the 3g connectivity.
Just to note that my configuration is working fine with a USB flash drive, 2GB featuring the same partition table and file systems, etc as the microSD card.
Here is the output with a successfully mounted usb flash drive partition as an extroot overlay:
[root@OpenWrt:/root]# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 504.4M 17.0M 461.8M 4% /
/dev/root 2.8M 2.8M 0 100% /rom
tmpfs 14.4M 76.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/sda1 504.4M 17.0M 461.8M 4% /overlay
overlayfs:/overlay 504.4M 17.0M 461.8M 4% /
/dev/sda3 1.3G 36.3M 1.2G 3% /mnt/storage
sda2 is set as a swap partition.
Unfortunately when trying the same with the microSD card installed in the hspa modem, sda1 is not mounted as extroot overlay.
BusyBox v1.19.4 (2012-08-02 02:04:49 EEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
ATTITUDE ADJUSTMENT (Bleeding Edge, r32775)
-----------------------------------------------------
* 1/4 oz Vodka Pour all ingredients into mixing
* 1/4 oz Gin tin with ice, strain into glass.
* 1/4 oz Amaretto
* 1/4 oz Triple sec
* 1/4 oz Peach schnapps
* 1/4 oz Sour mix
* 1 splash Cranberry juice
-----------------------------------------------------
[root@sinemorec:/]# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 320.0K 244.0K 76.0K 76% /
/dev/root 2.8M 2.8M 0 100% /rom
tmpfs 14.4M 128.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock3 559.6M 17.1M 514.1M 3% /overlay
overlayfs:/overlay 320.0K 244.0K 76.0K 76% /
/dev/sda1 559.6M 17.1M 514.1M 3% /overlay
/dev/sda3 1.1G 35.7M 1.0G 3% /mnt/storage
[root@sinemorec:/]# cat /proc/swaps
Filename Type Size Used Priority
/dev/sda2 partition 131068 0 -1
This is what I can find in the kernel log
[ 49.230000] scsi 2:0:0:0: Direct-Access Vodafone MMC Storage MMC Sto PQ: 0 ANSI: 2
[ 49.250000] sd 2:0:0:0: [sda] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)
[ 49.270000] sd 2:0:0:0: [sda] Write Protect is off
[ 49.270000] sd 2:0:0:0: [sda] Mode Sense: 0f 0e 00 00
[ 49.270000] sd 2:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
.........................................
[ 49.330000] sda: sda1 sda2 sda3
[ 49.360000] sd 2:0:0:0: [sda] Attached SCSI removable disk
[ 51.290000] br-lan: port 2(wlan0) entered forwarding state
[ 72.160000] eth0: link down
[ 72.160000] br-lan: port 1(eth0) entered disabled state
[ 74.660000] eth0: link up (1000Mbps/Full duplex)
[ 74.660000] br-lan: port 1(eth0) entered forwarding state
[ 74.670000] br-lan: port 1(eth0) entered forwarding state
[ 76.670000] br-lan: port 1(eth0) entered forwarding state
[ 77.070000] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem
[ 77.130000] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 77.800000] Adding 131068k swap on /dev/sda2. Priority:-1 extents:1 across:131068k
[ 78.840000] EXT4-fs (sda3): mounting ext3 file system using the ext4 subsystem
[ 78.890000] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
Nothing suspicious according to me. As you can see the swap is set up correctly.
This is my fstab configuration in both cases - USB flash drive and microSD card in the modem
root@OpenWrt:/# cat /tmp/rootfs/etc/config/fstab
config global automount
option from_fstab 1
option anon_mount 0
config global autoswap
option from_fstab 1
option anon_swap 0
config mount
option target /overlay
option device /dev/sda1
#option uuid '' #optional, overrules device statement
option fstype ext3
option options rw,sync
option enabled_fsck 0
#option is_rootfs 1 # not more needed after r25787, but optional. For trunk versions newer than and including r25787
option enabled 1
config mount
option target /mnt/storage
option device /dev/sda3
#option uuid '' #optional, overrules device statement
option fstype ext3
option options rw,sync
option enabled_fsck 1
#option label 'Storage_Main'
option enabled 1
config swap
option device /dev/sda2
#option uuid '' #optional, overrules device statement
option enabled 1
Just to emphasize that I removed the /.extroot.md5sum after transferring the data from the /overlay to the external storage.
ps.
And this is a full kernel log on how the modem with the microSD card is recognized (the stick is plugged in after the system boot).
Aug 2 18:52:36 kernel: [ 286.960000] usb 1-1: new high-speed USB device number 6 using ehci-platform
Aug 2 18:52:36 kernel: [ 287.500000] scsi0 : usb-storage 1-1:1.0
Aug 2 18:52:37 usb-modeswitch: 1-1:1.0: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:52:37 usb-modeswitch: 1-1:1.0: Selecting /etc/usb_modeswitch.d/19d2:2000 for mode switching
Aug 2 18:52:37 usb_modeswitch: switching device 19d2:2000 on 001/002
Aug 2 18:52:39 kernel: [56296.790000] usb 1-1: USB disconnect, device number 6
Aug 2 18:52:45 kernel: [56302.820000] usb 1-1: new high-speed USB device number 7 using ehci-platform
Aug 2 18:52:45 kernel: [56303.350000] usbserial_generic 1-1:1.0: generic converter detected
Aug 2 18:52:45 kernel: [56303.360000] usb 1-1: generic converter now attached to ttyUSB0
Aug 2 18:52:45 kernel: [56303.370000] usbserial_generic 1-1:1.1: generic converter detected
Aug 2 18:52:45 kernel: [56303.370000] usb 1-1: generic converter now attached to ttyUSB1
Aug 2 18:52:45 kernel: [56303.380000] usbserial_generic 1-1:1.2: generic converter detected
Aug 2 18:52:45 kernel: [56303.390000] usb 1-1: generic converter now attached to ttyUSB2
Aug 2 18:52:45 kernel: [56303.390000] usbserial_generic 1-1:1.3: generic converter detected
Aug 2 18:52:45 kernel: [56303.400000] usb 1-1: generic converter now attached to ttyUSB3
Aug 2 18:52:45 kernel: [56303.400000] usbserial_generic 1-1:1.4: generic converter detected
Aug 2 18:52:45 kernel: [56303.410000] usb 1-1: generic converter now attached to ttyUSB4
Aug 2 18:52:45 kernel: [56303.420000] scsi5 : usb-storage 1-1:1.5
Aug 2 18:52:46 kernel: [56304.420000] scsi 5:0:0:0: Direct-Access Vodafone MMC Storage MMC Sto PQ: 0 ANSI: 2
Aug 2 18:52:46 kernel: [56304.430000] sd 5:0:0:0: [sda] 3842048 512-byte logical blocks: (1.96 GB/1.83 GiB)
Aug 2 18:52:46 kernel: [56304.440000] sd 5:0:0:0: [sda] Write Protect is off
Aug 2 18:52:46 kernel: [56304.450000] sd 5:0:0:0: [sda] Mode Sense: 0f 0e 00 00
Aug 2 18:52:46 kernel: [56304.450000] sd 5:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Aug 2 18:52:46 kernel: [56304.480000] sda: sda1 sda2 sda3
Aug 2 18:52:46 kernel: [56304.500000] sd 5:0:0:0: [sda] Attached SCSI removable disk
Aug 2 18:53:08 usb-modeswitch: 1-1:1.0: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:08 usb-modeswitch: 1-1:1.1: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:08 usb-modeswitch: 1-1:1.2: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:08 usb-modeswitch: 1-1:1.3: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:09 usb-modeswitch: 1-1:1.4: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:09 usb-modeswitch: 1-1:1.5: Manufacturer=Vodafone_(ZTE) Product=Vodafone_Mobile_Broadband_K3765-Z Serial=P673A1VDF_MS
Aug 2 18:53:10 pppd[5940]: pppd 2.4.5 started by root, uid 0