OpenWRT: Expand Storage Space and Memory

When using OpenWRT on relatively cheap routers, low memory and storage becomes a bottleneck, preventing you from installing a lot of packages and really unleashing the true computing power of your router. In this tutorial, we are gonna use a USB storage device (Flash Drive, Portable Hard Drive or whatever) to expand our memory. Now it’s time to get our hands dirty!

And, if you didn’t know about OpenWRT, it is a third-party after-market firmware available for many routers. (You can think of it as Cyanogenmod for Routers)

What you need

  • A Router with a USB port and OpenWRT 12.09-rc1 or greater installed

  • A USB Storage Device (Flash Drive, USB HDD, Memory cards…)

  • A good partitioning tool (I suggest GParted)

It’s a good idea not to use memory cards like SD or MicroSD, they are prone to read-writes and might wear out very soon.

Partitioning the storage

I am using a 4GB USB Flash Drive as my storage device. Just plug it in to your system and launch your partition manager. Remvoe previous partitions and create two new partitions.

  • An ext3 partition –> 3GB

  • A swap partition –> 768MB

Actually you don’t need that much of swap, you can allocate as much memory as you want. Just remember four things,

  • The ORDER is important. The ext3 should be the FIRST partition, swap should be the second one.

  • The ext3 one will hold your data, programs and all other stuff.

  • The swap partition will act as a boost of RAM.

  • The frequent swap read-writes WILL reduce the lifespan of your USB flash storage. (Not a problem with Hard Drives)

Mounting the device

  1. Connect the USB Storage Device via the USB port of your router.

  2. Login to the OpenWRT Control Panel with your browser.

  3. Go to System > Mount Points from the menu. You will see your device getting detected.

  4. Now, click on the edit button of the /dev/sda1 device.

  5. Check Enable this mount, select ext3 as the Filesystem, check Use as root filesystem and finally click Save and Apply.

  6. Come back to System > Mount Points, and click the edit button of the swap partition. Check Enable this mount and click Save and Apply.

  7. Now reboot the device from System > Reboot.

Knowing if we are successful

  1. Login to your router console via SSH.

  2. Run the commands df -h and free!

Yeppi! Now you have a boost of storage and memory ready!