[arch-general] systemd-zram generator

Chris Murphy lists at colorremedies.com
Mon Jan 13 04:51:15 UTC 2020


swap-create at .service generator for zram devices

zram: Compressed RAM based block devices

The gist is, if a configuration file exists, a /dev/zram0 device is
created during early boot and marks it for use by swap.target; so all
the existing systemd stuff to mkswap and swapon gets used.

The nice thing is, very low overhead. RAM is not reserved for the
device, it's only consumed as needed.

The generator could be installed by default, but without a
configuration file. In that case, it doesn't create a swap on zram
device, unless the user creates a configuration file. And at some
point, the distribution can decide to include a configuration file by

I'm thinking a useful yet conservative default would be to create a
device up to 1:1 with RAM, capping out around 2G-4G. That way small
RAM devices, like Pi's, get a pretty big zram device. And large RAM
devices just have a smallish swap for incidental usage.

One issue (reported upstream in github) is getting priority supported.
I don't know whether it needs to be configurable, from the config
file. But it seems sane to have the generator set a high priority, so
that the zram device is used first, spilling over to a conventional
swap if the user creates ones.

This is a project in rust. And I think once some of the issues get
worked out, it would be great if distributions can converge on this


Chris Murphy

More information about the arch-general mailing list