Topic: install packages on USB-Stick ? [TL-MR3020]

Hello everybody,
i want to know if it is possible to install packages like "radvd", "openvpn" etc on an USB-Stick, because the Memory of my TL-MR3020 is very small and  also full know!
If it is possible could someone please tell me how i could do this, that opkg install openvpn will be installed on an external USB-Stick!


2 (edited by valentingalea 2012-04-01 10:33:23)

Re: install packages on USB-Stick ? [TL-MR3020]

Yes it's possible and it's great!

1. First make sure you have full working USB support: install these packages (on the device)

2. prepare an USB stick by formating it with an ext2 filesystem - you won't be able to do this from the router itself (installing the filesystem tools packages takes too much space), either:
a) do it from Windows with various tools, for example: EASEUS Partition Master 9
b) do it from some other Linux with: mke2fs /dev/<usb device>

3. plug the stick in the router and mount it:
mount -t ext2 /dev/<usb device> /mnt/usb/
<usb device> usually it's sda1
/mnt/usb must be first created with mkdir, or you can use /mnt directly - from now on i'll assume /mnt/usb/ was used

4. prepare opkg for external installs
edit /etc/opkg.conf and add an extra line that maps the destination "usb" to the path where you mounted the stick
dest usb /mnt/usb/

5. prepare the extra paths for executables and libraries:
export USB=/mnt/usb
export PATH=$PATH:$USB/usr/bin:$USB/usr/sbin
export LD_LIBRARY_PATH=$USB/lib:$USB/usr/lib

6. install whatever you want on the external storage with:
opkg install <package> -d usb

so "-d usb" is the key, make sure you don't forget it otherwise packages will be installed in the router storage itself and will quickly fill it up leading to corruption!

* you will want to automate steps 3 and 5 somehow otherwise on the next reboot it won't work and you'll have to run them again
for #5 edit /etc/profile and add the variables there

* some programs need additional config files to run, you will have to create links between the root filesystem and the usb one
for example for successfully running Midnight Commander after installing it on usb run:
ln -s $USB/usr/share/terminfo/ /usb/share/
ln -s $USB/etc/mc /etc/mc


Re: install packages on USB-Stick ? [TL-MR3020]

You could have read and linked to opkg - Installation Destinations, but why not ask and explain things 1000times?

Re: install packages on USB-Stick ? [TL-MR3020]

Hello valentingalea,
thank you for your very helpful and detailed explanation!


Re: install packages on USB-Stick ? [TL-MR3020]

Ok, I saw the point and wrote a recipe: Recipe: Howto Install Packages on a USB-Stick

6 (edited by RicoCoco 2012-06-29 14:48:40)

Re: install packages on USB-Stick ? [TL-MR3020]

hi, everybody,
I've just seen these posts and I'm wondering which "strategy" to adopt regarding the "right way for doing" Flash File extension.

I explain :
I was also disapointed by the amount of on board FLASH and decided to switch it to an external (recycled) Ext4 64Mb USB pen drive.

On board 4Mo are really too small and I even had to first remove few packages before being able to start pivoting the overlay (the USB packages are really hungry smile
I followed the Extroot howto and every thing runs well !

The purpose seems to be more or less equivalent for what I can name : "user space extension " but i'm sure there are other counterparts I haven't identified.
So, this leads me to ask myself  and you guys if I did well and if it can't be somewhat dangerous e.g. to much W/R access(?)

Appart from the fact that once I've pivoted the overlay i don't need to bother with opkg destination extension and PATH exports, what else  may be taken into account for a box that should run some CRON'ed scripts and acts as a datalogger (Sqlite3 cli) with mutliwan connection (Eth +3G backup) for  downloading the database dump daily ?

thanks for any hints you may provide

Among other things, running MR3220 for weather station automatic report ( )
Thank you TP-link for offering these MR3x20 boxes. 'hope they'll be produced for a loooong time :o)