This post I expect OpenWrt has been installed, if not please refer my previous post. The full documentation about Extroot can be found from this link http://wiki.openwrt.org/doc/howto/extroot .
The step showed here is the working implementation on TP-Link MR3020 using the following environment.
Firmware Version: OpenWrt Attitude Adjustment 12.09
1. USB 2.0 Hub
2. USB 2.0 Flash Drive (~8GB)
3. ZTE MF-190 3G Modem
The first step you need to format the flash drive to ext4 partition, I use 3rd party software to do this (in Windows 7) which was free MiniTool Partition Wizard Home Edition.
The partition should looks like the screenshot.
I created 1024MB for Swap and the rest for ext4 partition, adjust according to your need just make sure the arrangement ext4 first then the swap. Also ensure create as must be primary. Don’t forget to click apply. The process could take few minutes depends on the size of the disk.
After the partitioning finished plug the flash drive to the router.
Login to the router via SSH, install all the required packages. The router need to have internet to do this.
1 2 |
# opkg update # opkg install block-mount kmod-usb-storage kmod-fs-ext4 |
Copy the rootfs from flash memory to flash drive that mounted on /mnt/sda1
1 2 3 4 5 6 |
# mkdir /mnt/sda1 # mount /dev/sda1 /mnt/sda1 # mkdir -p /tmp/cproot # mount --bind / /tmp/cproot # tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf - # umount /tmp/cproot |
I was using pivot overlay for the implementation which mean the /dev/sda1 is mounted to /overlay filesystem.
Edit /etc/config/fstab using your favorite editor.
1 |
vim /etc/config/fstab |
My original configuration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
config global automount option from_fstab 1 option anon_mount 1 config global autoswap option from_fstab 1 option anon_swap 0 config mount option target /home option device /dev/sda1 option fstype ext4 option options rw,sync option enabled 0 option enabled_fsck 0 config swap option device /dev/sda2 option enabled 0 |
Change it according to the following
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
config global 'automount' option from_fstab '1' option anon_mount '1' config global 'autoswap' option from_fstab '1' option anon_swap '0' config mount option target '/overlay' option device '/dev/sda1' option fstype 'ext4' option options 'rw,sync' option enabled_fsck '0' option enabled '1' config swap option device '/dev/sda2' option enabled '1' |
Save and reboot. The router should boot from the flash drive. To confirm run df -h or from the luci Sytem->Software look for the free space.
Login to ssh again and change the /etc/config/fstab in case it is difference.
You might want to plug 3G modem on the USB hub, refer my previous post 🙂