Use an SD Card to expand your root on a GL.iNet AXT1800 Router

These instructions were based on the info here:

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

I just tweaked it to use my 128 GB SD Card.

Grab the packages you need for this setup:

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

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 SD Card: (Mine is /dev/mmcblk0p1)

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

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

DEVICE="/dev/mmcblk0p1"

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.