Enabling ZRAM in EndeavourOS and Optimizing swap on zram

Hey
I have enabled zram on my system.

But I doubt whether I have done it right.

below is my zram-generator.conf content.

[zram0]
zram-size = ram / 2
compression-algorithm = zstd
swap-priority = 100
fs-type = swap

But depending on what kind of guide you follow, different things are suggested.
I want to know if mine looks right.

I’m also confused about what should be on my 99-vm-zram-parameters.conf
arch wiki suggest this:

vm.swappiness = 180
vm.watermark_boost_factor = 0
vm.watermark_scale_factor = 125
vm.page-cluster = 0

The other guide I found suggested this:

vm.vfs_cache_pressure=500
vm.swappiness=100
vm.dirty_background_ratio=1
vm.dirty_ratio=50

I have 16GB ram. Will 4GB zram honor enough?

You could use the following script to configure the parameters:

1 Like

OK thanks.
But do the other things look right enough?
I’m a bit doubtful if 8GB zram is too much when I have 16GB ram. Everything works fine on my computer. The reason I want zram is so my computer can hibernate.

Even though zram is a swap space, it is a

compressed block device in RAM, i.e. a RAM disk with on-the-fly disk compression
https://wiki.archlinux.org/title/Zram

You cannot hibernate (aka suspend-to-disk) in RAM.

You would need to setup a swapfile or a swap partition for that.

https://wiki.archlinux.org/title/Hibernate#Hibernation

Ok, but my old computer could suspend and hibernate with zram. Maybe I’m wrong, but I’m pretty sure.

I’ll try the swap partition and see how it goes. But at the end of the day I don’t care about suspend or hibernation. What is important to me is that when I log out, my computer must stop using power.
Right now it’s using power and running vidr when I log out.

It is impossible to use zram for hibernation (suspend to disk).

When hibernating, the current state of the system is written to disk (the swap device) and the machine is completely powered off.

However, suspension, that is, suspend to RAM, will power off the system except the RAM which contains the current state of the system.

Please refer to: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate

1 Like

Ok and thanks.
I’ll read up on the stuff you link to, and convert my zram to a swap partition.

1 Like

Are this parameters advised by maxperfwiz alright?

vm.swappiness=10
vm.vfs_cache_pressure=75
kernel.nmi_watchdog=0
vm.dirty_bytes=419430400
vm.dirty_background_bytes=209715200
vm.dirty_expire_centisecs=3000
vm.dirty_writeback_centisecs=1500

To better understand the values you should take a look at the script to see what it actually does, which you should always do before running any script by the way. This particular script explains what the values do.

I’m not sure if looking at the calculations in the script have anything to do with the imho extreme output/advise the script presents.But, I may be wrong:-)

The calculations are exactly that, calculations. They are based on the amount of RAM in your system.

Thanks, I had no idea.