Use an Thumb Drive to expand your root on a GL.iNet GL-AR300M16-Ext Router

These instructions were based on the info here:

https://openwrt.org/docs/guide-user/additional-software/extroot_configuration

I just added a few tips to make the update flow smoothly. First of all, I had to do a factory reset because following these instructions caused my disk space to fill up. This is because I had already installed Luci and other various apps.

Grab the packages you need. I omitted “parted”, because it wasn’t in the opkg repository, but I didn’t need it for this.

opkg update
opkg install block-mount kmod-fs-ext4 e2fsprogs

These commands set the DEVICE environment variable for the current mount point so we can use it later:

DEVICE="$(sed -n -e "/\s\/overlay\s.*$/s///p" /etc/mtab)"
uci -q delete fstab.rwm
uci set fstab.rwm="mount"
uci set fstab.rwm.device="${DEVICE}"
uci set fstab.rwm.target="/rwm"
uci commit fstab

Formatting your Thumb Drive: (Mine is a 64 GB USB 2.0 on /dev/sda1)

umount /dev/sda1
mkfs.ext4 -L extroot /dev/sda1

Setting your router to use this new filesystem as your boot drive:

DEVICE="/dev/sda1"

eval $(block info ${DEVICE} | grep -o -e "UUID=\S*")
uci -q delete fstab.overlay
uci set fstab.overlay="mount"
uci set fstab.overlay.uuid="${UUID}"
uci set fstab.overlay.target="/overlay"
uci commit fstab

Copying over your current root to the new file system and rebooting:

mount ${DEVICE} /mnt
tar -C /overlay -cvf - . | tar -C /mnt -xf -
reboot

That’s it, you now have more space for your programs.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.