Using the zRam swap file

Starting with KeeneticOS v2.09 in the Keenetic devices, you can enable the zRam swap file. You may need a swap file for the correct operation of the built-in Transmission torrent client.

zRam - the Linux kernel module (formerly known as compcache) that increases performance by preventing data paging to the hard disk drive and using RAM compression (the lzo compression algorithm) until you need to use a swap file on the hard drive.

The data exchange rate with RAM is much faster than with a hard disk drive; therefore, zRam allows more swap operations on devices with a small amount of RAM. Also, zRam will be useful for SSDs that use flash memory, which has a limited number of overwrite cycles.

To use zRam, you need to go to the settings of the Keenetic router through the command-line interface (CLI) and execute commands:

(config)> system zram
(config)> system configuration save


When you execute the system zram command, the system will automatically determine the recommended file size. As a rule, the size of the zRam file corresponds to the size of Keenetic RAM.

In our example, the RAM size of Keenetic Titan (KN-1810) is 256 MB or 262016 Kbytes (you can see it in CLI):

(config)> show system

hostname: Keenetic_Titan
domainname: WORKGROUP
cpuload: 1
memory: 41908/262016
swap: 0/262012
memtotal: 262016
memfree: 183428
membuffers: 9248
memcache: 27432
swaptotal: 262012
swapfree: 262012
uptime: 824

In our case, the system automatically selected the swap file size equal to 256 MB.

You can use the following command to view the zRam parameters:

(config)> show system zram

enabled: yes
compression-algo: lzo
disk-size: 262016456
compressed-size: 87
original-size: 4096
total-memory-used: 12288
compression-threads: 2
compressed-ratio-pcs: 300

To disable memory compression, you can use the command system no zram

(config)> system zram
Zram::Manager: Enabled zram swap of size 262144Kb.
(config)> system no zram
Zram::Manager: Zram swap disabled.

If the swap file size is not enough, you can connect an automatically mounted swap partition. ZRam and swap can work together.


Was this article helpful?

55 out of 56 found this helpful

Have more questions? Submit a request