What is zram precisely? Is this a swap partition?
Yes. It is like a swap fille or partition. It works like a swap partition. It is installed by default on the L5 but it is only 1.4G. I had several lags, frozen screen, crashes before i did that.
Thanks for the tip! I’ve added these instructions to the Librem 5 community wiki: https://source.puri.sm/Librem5/community-wiki/-/wikis/Tips%20&%20Tricks#resize-zram
I think ZRAM
is part of RAM, while swap
is part of storage device.
Thanks, that is interesting.
You might want to read this thread:
which discusses this. There is a lot of opinion in it, so you need to keep your critical thinking engaged while you form your own opinion. (I don’t endorse or dispute anything written in it.)
Thanks. Don’t forget to read my update to make it persistent after reboot…
You created the swap file in the RAM that is almost two times bigger than the RAM size! It is something really strange… Could you provide the output for free -h
command at a maximum load?
Yes but it works like a charm! I did not created a swap file, just used the default zram0.
free -h:
total utilisé libre partagé tamp/cache disponible
Mem: 2,8Gi 2,1Gi 98Mi 208Mi 686Mi 487Mi
Partition d'échange: 4,2Gi 2,7Gi 1,6Gi
You created the swap file in the RAM that is almost two times bigger than the RAM size! It is something really strange… Could you provide the output for
free -h
command at a maximum load?
I don’t think it’s that strange:
I have a Chromebook Tablet with 4GB Ram, and ChromeOS when that still ran it (it’s running postmarketOS now) was set up with 8GB of zram.
@Lionel : Well done! Regarding the config: I wonder if it would not be better to change the config that sets up zram by default to allow for more zram, instead of adding an additional service to change it on every boot. (My Librem 5 is not running PureOS right now, so I can’t look into it.)
Thanks for the detailed and clear update in wiki.
I tried yesterday with 5G of zram, and today with size-fraction = 1.5 RAM and max-size=none, with ram and zram usage at filled by 90%, my librem was still totally stable. I never had this experience before. It is really making it daily usable for me now ! It is day and night difference.
Could everyone report here his experience in order to make later a PR on the purism gitlab, so that new users make a better first UX with L5?
Great news. I was authorized to make a PR to make the change in the default pureos version for the librem 5!
Should be
sudo swapoff /dev/zram0
I tried doing the more permanent solution but it didn’t seem to like something about this setting it up as a service. It actually couldn’t find the service because instead of run_at_boot it was looking for run_at_boot.service.
I can confirm that extend ZRAM to 5 GB greatly improves stability, associated with the kernel fix solving my resume from suspend issue, it really does my L5 daily drivable
I ended up just using the zram-generator.conf method, that seems to work, but wondering about the best values to choose.
So the max-zram-size just constrains it to not exceed that amount? If you leave it blank it defaults to 4096? And then the fraction is the fraction of the the max-zram-size?
Best values are described in my original post:
zram-fraction = 2
max-zram-size = none
value 2 corresponds to 2*2.8G (Hardware RAM) = 5.6GB available in zram
So 2.8 + 5.6 = 8.4G of total memory.
More is useless after my tests (i tried tilll fraction 6) , because of the cpu limit if too much apps and work is running…
NB: It does not reduce free space on the disk.
PS: PR for the default pureos-librem5 is done, just waiting for merging by the admin’s team.
Instead of editing /usr/lib/systemd/zram-generator.conf.d/librem5.conf
, create a new file /etc/systemd/zram-generator.conf.d/librem5.conf
. Like with many systemd things, files in /etc
are overriding their counterparts in /usr/lib
.
How is your solution different from what Kyle Rankin describes here: My First Year of Librem 5 Convergence – Purism ?
I don’t know. I find my solution better (1.5G is not enough)