Sunday, 03 May 2015 23:42

How to increase storage on TP-Link TL-MR3020 with ExtRoot

How to increase storage on TP Link TL MR3020 with

The TP-Link TL-MR3020 N150 3G/4G Travel Router is a very small device with a size of 74mm x 67mm x 22mm, it has only 4MB flash and 32MB memory. The router have about 428KB (67%) space available after installing OpenWRT Barrier Breaker 14.07, you may encounter shortage of storage when installing certain extensions due to limited of router space. 

By employing OpenWrt's extroot, you can expand the storage capacity of your root file system using the additional space of an added storage device.

Prerequisites

  • TP-Link TL-MR3020 router must flashed with OpenWRT, I'm using Barrier Breaker 14.07 for my router.
  • TP-Link TL-MR3020 router must connected to the internet. Click here for more information.

 

Preparing the flash drive

The first step is to format the flash drive with two partitions, the Ext4 & Linux Swap partition as shown in figure below. I'm using MiniTool Partition Wizard Free to format the flash drive.

MiniTool Partition Wizard Free

After completing the formatting, eject the pen drive from the computer and plug it into the router.

 

Install required packages

Login to router via SSH and install all the required packages.

opkg install block-mount kmod-usb-storage kmod-fs-ext4

Chances are you will be seeing the following errors (failed to insert /lib/modules/3.10.49/ext4.ko). Just reboot the router without doing anything.

Configuring kmod-scsi-core.
kmod: failed to insert /lib/modules/3.10.49/sd_mod.ko
Configuring kmod-usb-storage.
Configuring kmod-crypto-hash.
Configuring kmod-lib-crc16.
Configuring block-mount.
Configuring kmod-fs-ext4.
kmod: failed to insert /lib/modules/3.10.49/ext4.ko

 

Get the name of the flash drive

I,m using a 8GB falsh drive, it was /dev/sda1

[email protected]:~# block info
/dev/mtdblock2: UUID="20ad40ea-d33a421e-785b7d2d-ada99230" VERSION="4.0" TYPE="squashfs"
/dev/mtdblock3: TYPE="jffs2"
/dev/sda1: UUID="cdfd73b1-8c85-d001-c0f0-72b18c85d001" NAME="EXT_JOURNAL" VERSION="1.0" TYPE="ext4"
/dev/sda2: VERSION="2" TYPE="swap"

  

Copy the rootfs from flash memory to flash drive

After entering all the following command, the flash drive now has a copy of the router’s root filesystem on it.

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

 

Make the router boot from flash drive

Login to router via WinSCP and edit the /etc/config/fstab file. Below is my original configuration.

config 'global'
option anon_swap '0'
option anon_mount '0'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'

config 'mount'
option target '/mnt/sda1'
option uuid 'cdfd73b1-8c85-d001-c0f0-72b18c85d001'
option enabled '0'

config 'swap'
option device '/dev/sda2'
option enabled '0'

 

Chage it to the following. Take note that target is changed from /mnt/sda1 to /

config 'global'
option anon_swap '1'
option anon_mount '1'
option auto_swap '1'
option auto_mount '1'
option delay_root '5'
option check_fs '0'

config 'mount'
option target '/'
option uuid 'cdfd73b1-8c85-d001-c0f0-72b18c85d001'
option enabled '1'

config 'swap'
option device '/dev/sda2'
option enabled '1'

 

Reboot the router and check  your space

[email protected]:~# df -h
Filesystem   Size      Used     Available    Use%   Mounted on
rootfs         6.0G     7.4M     5.7G          0%       /
/dev/root    2.3M     2.3M     0               100%   /rom
tmpfs         14.1M   356.0K  13.7M        2%       /tmp
/dev/sda1   6.0G     7.4M     5.7G          0%       /
tmpfs         512.0K  0          512.0K      0%       /dev

Read 17203 times Last modified on Thursday, 04 August 2016 12:54

15 comments

  • Comment Link admin Tuesday, 20 September 2016 16:48 posted by admin

    You can setup the router as a Samba Server, however the read/write speed is extremely slow.

  • Comment Link Nikki Monday, 19 September 2016 06:01 posted by Nikki

    Hi, i wanted to use my router as a normal device. I am using it as a eathernet to wifi. Can i connect usb flash drive to it to use as a nas too??
    I am not experienced. Please suggest. Thanks.

  • Comment Link admin Thursday, 04 August 2016 13:21 posted by admin

    I'm using a 16GB USB stick (formatted with 8GB) tested on BB 14.07. After successful ExtRoot, the USB stick is then connecting to the router via a USB hub, the router is able to boot with this USB stick without any changes to the settings.

  • Comment Link Lars Tuesday, 02 August 2016 13:01 posted by Lars

    I would like to use the wisp mode under openwrt but have no luck at the moment. Did anyone realize it successful?

    At the moment a have a second edimax usb dongle at a usb hub. the router recognize it but i can´t get it to work. can anybody help?

  • Comment Link admin Sunday, 31 July 2016 20:39 posted by admin

    Please refer to the link below:
    http://www.electronicsfaq.com/2015/12/openwrt-1505-chaos-calmer-on-tl-mr3020.html

  • Comment Link Lars Saturday, 30 July 2016 06:37 posted by Lars

    is there a real chance to get an extroot working with version 15.05 on a mr3020?

    i can´t get it to work to use the 16 gb usb stick (2 partitions with ext4 and 1 linux swap)

    i always get out of memory before i can move somthing to usb

    opkg install block-mount kmod-usb-storage kmod-fs-ext4
    Unknown package 'block-mount'.
    Package kmod-usb-storage (3.18.20-1) installed in root is up to date.
    Unknown package 'kmod-fs-ext4'.
    Collected errors:
    * opkg_install_cmd: Cannot install package block-mount.
    * opkg_install_cmd: Cannot install package kmod-fs-ext4.

    who can help me. do i have to use the 14.x version of openwrt?

  • Comment Link admin Wednesday, 01 June 2016 16:55 posted by admin

    Hi, WJCarpenter
    Thanks a lot for your kind information. How is your router right now?

  • Comment Link WJCarpenter Tuesday, 31 May 2016 02:36 posted by WJCarpenter

    A couple of notes about the custom image note I just posted.

    My /etc/config/fstab did not include any mention of sda1 nor sda2. I don't know where that info comes from, but it must be some package that I left out. Anyhow, I just copied the example given here and modified the UUID to the one that showed up for sda1 in the "block info" output.

    My swap partition didn't get automatically enabled. I turned out to be because the thumb drive had the copy of /etc/config/fstab from before the modifications. I edited the file again to set "anon_swap" and "anon_mount" to 1. I can't remember if "auto_swap" and "auto_mount" were already 1, but they are now.

  • Comment Link WJCarpenter Tuesday, 31 May 2016 02:29 posted by WJCarpenter

    I really wanted to do this same thing with Chaos Calmer, but there isn't enough space left in the standard builds to install the things you need to mount the ext4 USB partitions. So, I downloaded the Image Generator (https://wiki.openwrt.org/doc/howto/obtain.firmware.generate). It looks kind of complicated, but in practice it's pretty straightforward if you're on a 64-bit Linux machine.

    By trial and error, I added and removed packages until I got a working system that could follow the recipe given here. I left out a *lot* of stuff, but it can all be put back after getting all the space from the USB drive. In particular, I did not include Luci, so you should be comfortable with the command line. I left out the IPv6 stuff and the firewall stuff. I also added a few things that were not strictly necessary but of interest to me.

    I made a backup copy of my /etc/config/ directory, though it turned out that it was preserved across my many re-flashes.

    In case it's of interest, here is the command line I ended up with for building my custom image:

    make image PROFILE=TLMR3020 PACKAGES="-dnsmasq -firewall -kmod-ath9k-common -kmod-ip6tables -kmod-ipt-conntrack -kmod-ipt-core -kmod-ipt-nat -kmod-ipv6 -kmod-nf-conntrack -kmod-nf-conntrack6 -kmod-nf-ipt -kmod-nf-ipt6 -kmod-nf-nat -kmod-nf-nathelper -kmod-ppp -kmod-pppoe -kmod-pppox -kmod-slhc -libip4tc -libip6tc -libxtables -odhcp6c -odhcpd -ppp -ppp-mod-pppoe kmod-fs-ext4 libext2fs kernel kmod-lib-crc16 kmod-crypto-hash librt libpthread ubox libubox libuci kmod-fs-configfs kmod-usb-core kmod-usb-uhci kmod-usb-ohci kmod-usb-serial kmod-usb-serial-simple kmod-usb-storage kmod-scsi-core kmod-usb-storage-extras kmod-usb-hid kmod-hid kmod-hid-generic kmod-input-evdev kmod-usbip kmod-usbip-client kmod-usbip-server libusb-1.0 libusb-compat usb-modeswitch usbutils block-mount kmod-bridge kmod-stp kmod-ath kmod-mac80211"

  • Comment Link admin Friday, 27 May 2016 22:33 posted by admin

    You must get a 8MB or 16MB router such as GL.iNet in order to upgrade to Chaos Calmer:
    https://wiki.openwrt.org/toh/gl-inet/gl-inet_64xx

    "Of Modems and Men" may help you which is based on OpenWRT:
    http://www.ofmodemsandmen.com/downloadsm.html

    Ext-ROOter:
    http://www.ofmodemsandmen.com/downloadse.html

  • Comment Link WJCarpenter Thursday, 26 May 2016 01:39 posted by WJCarpenter

    Good details.

    For what it's worth, I have been trying to do the same thing with Chaos Calmer (15.05 and 15.05.1) on this same router model. They don't leave enough space to install the packages needed for this (or to even get the USB drive mounted if it uses ext4).

    When I get a chance, I'll install Barrier Breaker and follow your steps.

    I've been trying to figure out a way to upgrade to Chaos Calmer after doing these steps on Barrier Breaker. So far I have not thought of any way to do it. Just flashing a new firmware is going to wipe out the config for the mounts. Any ideas?

  • Comment Link admin Saturday, 14 May 2016 09:52 posted by admin

    Transmission Torrent should work with the same router provided transmission-daemon is installing on your router.

  • Comment Link Max vat Thursday, 12 May 2016 11:44 posted by Max vat

    Nice tuto. I want to know if in future I want to use higher capacity (32GB) flash drive. Should I follow complete procedure once again with same router device? Do I need to make any changes to router (3020) to migrate from 8gb to 32gb?. I want to try transmission. Thanks in advance

  • Comment Link admin Monday, 09 May 2016 10:54 posted by admin

    SSH to your router, you can access files on your router.
    But I would recommend using SAMBA:
    http://ediy.com.my/blog/item/28-tp-link-tl-wr1043nd-as-a-samba-file-server

  • Comment Link mzaiemo Monday, 09 May 2016 03:17 posted by mzaiemo

    Hello,
    i'm new to router hack, and EXRoot.
    this tutorial teach on how to expand memory on MR3020.
    Can i load files into thumbdrive and access files on PC?

Leave a comment

Back to Top