deweshk@HomeDesktop:~
➤ sudo systemctl status /dev/zram0
[sudo] password for deweshk:
â—Ź dev-zram0.device - /dev/zram0
Follows: unit currently follows state of sys-devices-virtual-block-zram0.device
Loaded: loaded
Active: active (plugged) since Thu 2022-06-23 11:55:44 IST; 25min ago
Until: Thu 2022-06-23 11:55:44 IST; 25min ago
Device: /sys/devices/virtual/block/zram0
Jun 23 11:55:44 HomeDesktop systemd[1]: Found device /dev/zram0.
deweshk@HomeDesktop:~
➤ zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram1 lzo-rle 271.9M 132K 2K 68K 4 /run/compressed-mount-point
Read this:
The zram-generator package provides a systemd-zram-setup@.service unit to automatically initialize zram devices without users needing to enable/start the template or its instances. The following resources provide information on how to use it:
zram-generator(8)
zram-generator.conf(5)
“The generator will be invoked by systemd early at boot”, so usage is as simple as creating the appropriate configuration file(s) and rebooting. A sample configuration is provided in /usr/share/doc/zram-generator/zram-generator.conf.example. You can also check the swap status of your configured /dev/zramN devices by checking the unit status of the systemd-zram-setup@zramN.service instance(s).
Then something is not quite right. You should be seeing something like:
Filename Type Size Used Priority
/dev/zram0 partition 4194300 0 100
in the output.
This is my conf if it can help
# This file is part of the zram-generator project
# https://github.com/systemd/zram-generator
[zram0]
# This section describes the settings for /dev/zram0.
#
# The maximum amount of memory (in MiB). If the machine has more RAM
# than this, zram device will not be created.
#
# "host-memory-limit = none" may be used to disable this limit. This
# is also the default.
host-memory-limit = 9048
# The size of the zram device, as a function of MemTotal, both in MB.
# For example, if the machine has 1 GiB, and zram-size=ram/4,
# then the zram device will have 256 MiB.
# Fractions in the range 0.1–0.5 are recommended.
#
# The default is "min(ram / 2, 4096)".
zram-size = min(ram / 10, 2048)
# The compression algorithm to use for the zram device,
# or leave unspecified to keep the kernel default.
compression-algorithm = lzo-rle
# By default, file systems and swap areas are trimmed on-the-go
# by setting "discard".
# Setting this to the empty string clears the option.
options =
# Write incompressible pages to this device,
# as there's no gain from keeping them in RAM
#writeback-device = /dev/zvol/tarta-zoot/swap-writeback
# The following options are deprecated, and override zram-size.
# These values would be equivalent to the zram-size setting above.
#zram-fraction = 0.10
#max-zram-size = 2048
[zram1]
# This section describes the settings for /dev/zram1.
#
# host-memory-limit is not specified, so this device will always be created.
# Size the device to a tenth of RAM.
#zram-size = ram / 10
# The file system to put on the device. If not specified, ext2 will be used.
#fs-type = ext2
# Where to mount the file system. If a mount point is not specified,
# the device will be initialized, but will not be used for anything.
#mount-point = /run/compressed-mount-point
I am not really sure.
I haven’t just had time to investigate it yet.
When setting up zram, I saw there was an error regarding that writeback device saying it was not found. So I just un-commented that and zram started working.
We are all on some place or other on a learning curve.
I found this forum a great place for learning things and hopefully get the chance to passing it on to others.
Also, the odd thing regarding this writeback device is that that there is no reference to it in
man zram-generator.conf
Nor what I could see on the project’s Github page.
Previously, I hadn’t seen that option in the conf file.
Edit:
Looks like it was introduced in:
# Write incompressible pages to this device,
# as there's no gain from keeping them in RAM
writeback-device = /dev/zvol/tarta-zoot/swap-writeback
Not sure then if what is specified is the default why then it will error?
At any rate I don’t know then if it is on the users to modify it or not and how.
Maybe, later on, I make a post and ask the forum. Or perhaps someone who knows looking into this thread might be able to shed some light on this.
Edit:
Pebcak, as my username suggests, I missed this:
writeback-device=
Write incompressible pages, for which no gain was achieved, to the specified device under memory pressure. This corresponds to the /sys/block/zramX/backing_dev parameter.
Takes a path to a block device, like /dev/disk/by-partuuid/2d54ffa0-01 or /dev/zvol/tarta-zoot/swap-writeback.
If unset, none is used, and incompressible pages are kept in RAM.