I have a Linksys WRT1900AC which comes with 256MB RAM which is far more than a lot of routers, but I have installed the Speedtest client from https://github.com/sivel/speedtest-cli and when doing the tests It does utilise RAM so SWAP will be useful here.
Using https://oldwiki.archive.openwrt.org/doc/uci/fstab as the guide I have succesfully enabled SWAP by using the following commands:-
mkswap -L SWAP /dev/sdb2 swapon /dev/sdb2
From my understanding you have to create a Linux Swap partition for which the SWAP file goes onto correct?? Just with the above command is that always necessary or can I just soley create a SWAP partition with the SWAP file.
I created the SWAP partiion by installing 'fdisk' and setting the '/dev/sdb2' partition to Linux Swap (Hex 82) and then through the LuCI GUI > System > Mount Points and clicking on the add button under SWAP. However, I couldn't ever get this to work. The overview never showed SWAP and when uisng the 'free' command the SWAP showed as 0. On the other hand creating the SWAP file seems to fix this.
Slightly off-topic but does the SWAP file survive factory resets? To cut a long story short I compiled my own firmware which I have pre-setup all of the configurations settings so it is literally plug and play. Instead of issuing the 'mkswap' command everytime, is there a directory or file that holds the SWAP file settings?
Could someone shed some light on this please?