How to enable zswap?

I had a swapfile, I deleted it and disabled it through fstab
According to this link, I activated zswap
But there is a problem when I run the free -h command, the value of swap shows zero
Do I have to enable swafile ?

Zswap is not a swap device like a swapfile or swap partitio. It is a kernel feature which works in conjunction with a swap device. This feature is enabled by default in the kernel.

You would need a swapfile or swap partition to take advantage of this mecahanism.

2 Likes

Can I write these settings(zswap.enabled=1 zswap.compressor=lz4 zswap.max_pool_percent=20 zswap.zpool=z3fold) in the “GROB_CMDLINE_LINUX=” section?

I am not sure if any of those are necessary.

This is not needed since zswap is enabled by default.

Also the other values seems to be default as well.

Run:

grep -R . /sys/module/zswap/parameters

to check.

2 Likes

Thanks for the help, does this also apply to zram?

No. Zram is a swap device but in RAM. It can function without any additional swap device.
If you want to use zram, then you need to disable zswap according to the Wiki by adding zswap.enabled=0 to your kernel parameters

1 Like

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