Improve memory consumption on MOX or increase swap

Wanted to buy 1GB MOX but ended up buing used 512MB Pocket WIFI for half the price hoping I could squeeze in all the necessary tools (TOS6, docker, portainer agent, zigbee2mqtt, netclient, streaming netdata node). Turns out it’s quite borderline as swap sometimes hits 100% (like when updating) and I would like to give it a little more space.

  1. How to increase swap? I have virtually unused SD card there, swap can be 1GB for all I care.
  2. I’ve noticed reForis (controller, fosquitto) takes largest chunk of memory, can it be optimized (run on demand) or turned off (temporarily disabled)?

Thanks.

Have you tried to just create a swap file and enable it? If that works, add it to /etc/fstab and check if it’s still in use after a reboot. I assume it works like on every other Linux.

  1. Swap on sd card is a very bad idea. Plug in a usb3 drive. Turris os 6.2.2 (currently in beta) should work with it.
  2. Reforis only takes memory when you use it. I.e. before the first access after a reboot, it should be loaded only in a minimalistic version.

Setting up swap is a pretty standard linux procedure. Just format a partition and mount it as swap.

Is zram active on Turris OS? the compression with zram can be very useful, but I think it depends on the workload. Needs a bit of experimentation. zram can be combined with a swap partition. I haven’t found any nice guidance material as regards OpenWRT or Turris OS so… would require some testing.

1 Like

@cocturr set me on the right path. Turns out TurrisOS indeed already uses zram and thus all I had to do was to find where it reads the size value and change it.

uci set system.@system[0].zram_size_mb=512
uci commit
reboot

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.