The chances are that you have a router with a USB port, just like I have my TP-LINK TL-MR3420 router. It is likely that with more intense usage of your router, you will need more disk space. This can be achieved by connecting any USB storage device into the USB port of the router, such as pendrive, external HDD, memory card reader, cell phone, etc.. Unlike a Linux Desktop, OpenWRT is starved of disk space in the extreme. One way to overcome limitations and gain some “Mega” space is to remove installed kernel modules. This may not be at all very convenient, In general, for router with USB port, OpenWRT includes kmod-usb2, a pre-installed basic module support for USB, which can be expanded to allow for external storage.
Basic Equipment Requirements
– TP-LINK TL-MR3420 Router* with OpenWRT Linux distribution for embedded devices and stable release of Attitude Adjustment.
– USB Hub* with power supply
– Hard disk drive** with USB connection
* I have a 4-port USB hub CN-050 v.1.002 from SITECOM with external power supply (cost 16,55€)
** In my case, I have an old 2,5″ 150GB SATA HD (bought long ago, I don´t remember how much probably 75,00€) that I decided to put into an external BlueRay USB box (cost 13,99€).
Preparing the SATA HDD
Our SATA HDD needs to be partitioned and formatted to be recognised by OpenWRT.
We use MiniTool Partition Wizard Home Edition. Besides being free it is easy to use. Hook up your SATA HDD to your PC.
We partition our SATA HDD as follows:
Partition 1 with 1GB for LinuxSwap and Partition 2 for Ext4 with remainder space of our SATA HDD.
Setup USB, Swap and ExtRoot
Make sure you have Internet connection. In my case I have my router with static IP address 192.168.1.1 with main gateway pointing to address 192.168.1.254 belonging to my ADSL router THOMSON TG585i V.7, with Internet and custom DNS server pointing to Google´s Open DNS address 126.96.36.199.
STEP 1: Next start LuCI in your favorite browser by pointing the URL to your router´s static IP, in my case 192.168.1.1
STEP 2: We next install kmod-ub-storage packages. In Filter field write kmod-usb-storage and click onto Find package. The result will be shown below as shown.
Install kmod-usb-storage-extras by clicking onto Install link on the left side of found package. A popup window will ask you to confirm if you want to intall
STEP 3: We will next install filesystem packages. First we find the packages by writing in Filter field kmod-fs
We will install kmod-fs-ext4 package by clicking Install link on the left of found package.
Again a popup window will ask us if we want to install kmod-fs-ext4 package and we will click OK button. Results of installations of packages will be shown as previously.
STEP 4: We will finally install block packages. First we find the packages by writing in Filter field mount-
We will install block-mount package by clicking Install link on the left of found package.
Again a popup window will ask us if we want to install block-mount package and we will click OK button. Results of installations of packages will be shown as previously.
It is interesting to note that all installations have reduced the available in my case to 38%.
STEP 5: We will plugin the Hub now where we have connected the SATA HDD. The following image shows my setup
We next reboot the router in System -> Reboot tab
STEP 6: After reboot launch PuTTy and perform the shown commands
STEP 7: After reboot, launch WinSCP (I have vi that is included in OpenWT). Go to ” /etc/config ” folder and locate and edit the file fstab
Edit fstab as shown below taking note specially that /dev/sda1 is partition 1 (LinuxSwap) and /dev/sda2 is partition 2 (Ext4 for Data) and do slight modifications as shown below
Back to LuCI perform reboot again
After rebooting go to System -> Software tab and Voila!
A while ago we saw we had 38% of memory now we have 100% and much more memory! Note that there are no package lists. We will do something about this later.
STEP 8: Let us now check what is going checking mount points in System -> Mount Points tab and in my case at least, swap was not enabled which we will do by ticking Enabled as shown
We also note that mount point /overlay is correctly mounted in /dev/sda2.
Do next reboot again
STEP 9: As a final act of confirmation launch PuTTy and perform the commands as shown df -k and next free
STEP 10: It seems all is fine. Now we will update the package lists like in STEP 1 and do something final about spin of HDD.
Back in LuCI in System -> Software tab perform Actions of searching with keyword luci in Filter field
And choose to Install luci-app-hd-idle, a utility to spin down the hard drive. A popup window will ask you if you want to install luci-app-hd-idle and you will press OK button and you will see that the package will be installed
A new tab will be added called Services. Choose Services
Enable hd-idle as shown and Save & Apply
We have concluded our task of USB, HDD, Rootfs and Swap. By installing hd-idle we have proved that the HDD has substituted the internal limited memory of our router.
A special thank you is due to K. L. Seet for excellent tutorial found at that website. Most of this post is based on that tutorial.