Is it possible to make all of RAM be ZRAM? Since Zram is already enabled by default, can we just increase its size to 100% of ram available? That was all ram is mumbo-jumbo…well, if not encrypted then at least compressed.
If you have less than 8 GB, zram will use all of it. This is defined in the /usr/lib/systemd/zram-generator.conf
file:
# This config file enables a /dev/zram0 device with the default settings:
# — size — same as available RAM or 8GB, whichever is less
# — compression — most likely lzo-rle
#
# To disable, uninstall zram-generator-defaults or create empty
# /etc/systemd/zram-generator.conf file.
[zram0]
zram-size = min(ram, 8192)
awesome! this is very relevant for example for running Fedora on a sh**ty (but corebooted) Chromebook.
and in that file you could also set the min size to whatever you want.
Some people only dream of coreboot.
I wish there was an easy way to encrypt zram too, especially if the entire RAM space is used for zram. Wouldn’t this be essentially close to the hardware implementation of secure encrypted RAM that AMD and Intel came out with recently-ish?
There is a bunch of supported hardware, we can make a thread in The Water Cooler
As far as I know, setting zram size to be equal to ram doesn’t use all of RAM since zram is compressed. The size you specify is the uncompressed size.
That being said, zram isn’t just compressed ram it is very fast swap/ramdisk. You don’t literally want your entire RAM to be zram.
My understanding is that the way zram is configured it takes a maximum of the amount that is stated in the generator config file. Even though by default /usr/lib/systemd/zram-generator.conf says that it will take a the lesser of 8G or full RAM it seems to only take half of the ram on a system with 8G ram.
My understanding is also a little different in how it works. The zram0 size is the maximum size total ram that is used. Since whatever may be stored there is compressed it is likely that the amount stored in zram swap may easily exceed the total size of zram once it is expanded back to main ram (4 GB zram could store close to 7GB of swapped data in compressed form).
It should be creating 8GB of zswap in that case. However, since it is compressed, it will only use half-ish of the actual RAM.