This is a kind of swap that resides on RAM in a compressed form. It will make swapping and ram usage more efficient and it will increase the lifespan of the sd card as well.
Resources:
https://openwrt.org/packages/pkgdata/zram-swap
https://openwrt.org/packages/pkgdata/kmod-zram
https://forum.openwrt.org/t/retracted-compressed-memory-this-project-is-officially-retracted-take-note-about-its-future/49076
https://forum.openwrt.org/t/mounting-swap-on-zram-with-discard/48451
https://forum.openwrt.org/t/possible-to-use-zswap/8916/6
https://stackoverflow.com/questions/24467604/swapon-failed-trying-to-enable-zram
Interesting read:
https://haydenjames.io/linux-performance-almost-always-add-swap-part2-zram/
https://ikarus.sg/using-zram-to-get-more-out-of-your-raspberry-pi/
Building:
kmod-zram kmod-lib-lzo (this is selected by default) kmod-lib-lz4 kmod-lib-zstd
Kernel config:
zswap zbud z3fold
Enabling zswap:
either:
opkg install zram-swap - will allocate half of ram size to zram0
echo 1 > /sys/module/zswap/parameters/enabled; in /etc/rc.local (if not enabled by default in kernel)
or
##inside rc.local
swapoff /dev/zram0;
echo 1 > /sys/block/zram0/reset;
echo lzo > /sys/block/zram0/comp_algorithm
echo 60M > /sys/block/zram0/disksize;
echo 1 > /sys/module/zswap/parameters/enabled; #seems to be enabled by default
mkswap /dev/zram0;
swapon -p 5 /dev/zram0;
#echo lz4 > /sys/module/zswap/parameters/compressor;
#echo z3fold > /sys/module/zswap/parameters/zpool;
#echo 20 > /sys/module/zswap/parameters/max_pool_percent;
#echo 75 > /proc/sys/vm/swappiness;
This is a kind of swap that resides on RAM in a compressed form. It will make swapping and ram usage more efficient and it will increase the lifespan of the sd card as well.
Resources:
https://openwrt.org/packages/pkgdata/zram-swap
https://openwrt.org/packages/pkgdata/kmod-zram
https://forum.openwrt.org/t/retracted-compressed-memory-this-project-is-officially-retracted-take-note-about-its-future/49076
https://forum.openwrt.org/t/mounting-swap-on-zram-with-discard/48451
https://forum.openwrt.org/t/possible-to-use-zswap/8916/6
https://stackoverflow.com/questions/24467604/swapon-failed-trying-to-enable-zram
Interesting read:
https://haydenjames.io/linux-performance-almost-always-add-swap-part2-zram/
https://ikarus.sg/using-zram-to-get-more-out-of-your-raspberry-pi/
Building:
kmod-zramkmod-lib-lzo(this is selected by default)kmod-lib-lz4kmod-lib-zstdKernel config:
zswapzbudz3foldEnabling zswap:
either:
opkg install zram-swap- will allocate half of ram size to zram0echo 1 > /sys/module/zswap/parameters/enabled;in /etc/rc.local (if not enabled by default in kernel)or
#echo lz4 > /sys/module/zswap/parameters/compressor;#echo z3fold > /sys/module/zswap/parameters/zpool;
#echo 20 > /sys/module/zswap/parameters/max_pool_percent;
#echo 75 > /proc/sys/vm/swappiness;