Monday, 2 September 2013

OpenWRT on WR703n Wireless Router with external USB Storage

This is taken directly from my webpage on the same subject. Might get some more helpful exposure this way.





The WR703N Router can be easily and cheaply sourced on eBay. However, most will come with a Chinese Firmware. I am not going to go into detail on loading OpenWRT on this page as there are many pages on the net describing this process. What I will describe is the easiest way to do the first easy hack, adding a external USB Thumb drive. In my case, I am using a 8Gb stick.
This particular setup shows an external 3dB Omni antanna I added as well. Could possibly still fit a RS232 to USB converter in here so can telnet straight to router without going through network, but that's another project for another day


Many sites describe installing various software packages and solutions to get this whole thing working, but no matter how I've tried to set it up, I have not yet succeeded. The easiest way, I have found, is to first partition and format the USB stick on a computer using Partition software, such as MiniTool Partition Wizard Home Edition
In my case, I formatted the USB drive with a 7Gb EXT4 file system on the first partition (set up as Primary) and a second partition of under 1Gb as Linux Swap (set up as another Primary). You will have to have your router setup on your home network, or have internet access to do the next stage. You might have to setup your /etc/conf/network file to suit your network.
Plug in your partitioned USB drive into the router and power up. Log in via ssh to your router and type the following commands into your terminal window.
The following commands remove unnecessary packages as will need room in the 32Mb Flash for the USB drivers.

opkg remove ppp* uhttpd luci* kmod-ppp* –force-removal-of-dependent-packages
opkg update
opkg install kmod-fs-ext4 kmod-usb-storage block-mount

Once this is done, your should be able to go into your /dev/ folder and look for where your USB Drive is mounted.. In my case /dev/sda /sda1 & /sda2. Now proceed to type in the following commands, one line at a time. Note: If your USB drive is mounted elsewhere for any reason, you will have to change all instances os /sda to your mount point. (/sdb etc...)

uci set fstab.automount=global
uci set fstab.automount.from_fstab=1
uci set fstab.automount.anon_mount=0
uci set fstab.autoswap=global
uci set fstab.autoswap.from_fstab=1
uci set fstab.autoswap.anon_swap=0
uci set fstab.@mount[0]=mount
uci set fstab.@mount[0].device=/dev/sda1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].options=rw,relatime,barrier=1,data=ordered
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].is_rootfs=1
uci set fstab.@swap[0]=swap
uci set fstab.@swap[0].device=/dev/sda2
uci set fstab.@swap[0].enabled=1
uci commit fstab
mount /dev/sda1 /mnt
mkdir /tmp/root
mount -o bind / /tmp/root
cp -a /tmp/root/* /mnt
umount /tmp/root
umount /mnt
reboot


Thant's it, you will have more storage for all the extra goodies available to OpenWRT on this relativly powerful wifi router for around $20

www.wolftech.net.au
BTC: 1EYadazzGU317MFtpg1JZtnwkafAZPd7Fz
LTC: LQWsQZncYij8rQHznwfq7TbvganJwNfMJb
FTC: 6rem3rkTy4Wd1NRdf5Puv5bSCnDXq1bXod