As TurrisOS is a fork of OpenWrt, most of the principles of OpenWrt are applicable to TurrisOS. Extroot is one of them.
Almost every router has a small amount of persistent memory. Turris Omnia has 8 GB of storage but developers say that this storage was not designed to be heavily used for read/write. Sometimes it can be an issue, for example if it is needed to:
/vardirectory instead of symbolic link to
opkgtarget installation pathes
There are several workarounds which involve creating symbolic links from the router's internal filesystem to the one which is mounted from USB device. But there is a choice which might be more convenient and reliable in some cases: extroot.
In OpenWrt there is a possibility to replace the root filesystem which is located in the internal memory with the one from external device during the boot. Original instructions for OpenWrt to achieve that can be found here.
If you fail, there is a possibility to soft-brick your device, so please do the backups! If you failed and router doesn't boot, please follow these instructions.
/(root). Others can be used for any custom mounts including swapping.
mkfs.ext4to re-format the partition.
mkdir -p /tmp/introot mkdir -p /tmp/extroot mount --bind / /tmp/introot mount /dev/sda1 /tmp/extroot tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf - umount /tmp/introot umount /tmp/extroot
Enable this mount.
Use as root filesystem (/)from
Mount pointcombo box.
SAVE & APPLY
# cat /etc/config/fstab 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 uuid '1f0e8e00-b854-49d2-97ee-4b57bdaccb1d' option target '/' option enabled '1'
/etc/config/fstabto the external filesystem:
mount /dev/sda1 /tmp/extroot cp /etc/config/fstab /tmp/extroot/etc/config/fstab umount /tmp/extroot
# mount /dev/mmcblk0p1 on /rom type btrfs (ro,noatime,ssd,space_cache,commit=X,subvolid=ABC,subvol=/@) ... /dev/sda1 on / type ext4 (rw,relatime,data=ordered) ...
/etc/configin sync between extroot and internal memory. I cannot say for sure at which exact moment the internal memory is replaced with the external one. It has to be
/etc/rc.d/S40fstab, so scripts with level less then 40 have to be loaded from internal memory while the others - from the external storage. Since
/romis obviously is read-only, to copy changed files from the extroot to internal memory, you'd have to remount it for read/write:
mount /rom -o remount,rw
schnappsmost probably will stop to work with extroot or will work with errors. It uses Btrfs snapshot feature to work but Brtfs is not supported by extroot. If you can shed some light on that, please update this article.
/varpermanent (reboot required):
cp -r /tmp /var-tmp rm /var mv /var-tmp /var