Package of the day - systemd-zram-service

So while doing some research on systemd (for another package of the day :wink: ) I came across this blog entry;

Using zram to create a RAM based block device which acts as a swap disk, but is compressed and stored in memory.

Uses? Well I guess if your running a ssd, not much RAM and use swap, this might be good for you?

I had to do a slight tweak on the start script for either current or newer kernels because of the zram module parm name change;

Install the package from here for your release;
http://software.opensuse.org/search?q=systemd-zram-service&baseproject=ALL&lang=en&include_home=true&exclude_debug=true

Enable and start the service;


systemctl enable zramswap.service
systemctl status zramswap.service

zramswap.service - Service enabling compressing RAM with zRam
	  Loaded: loaded (/lib/systemd/system/zramswap.service; enabled)
	  Active: active (exited) since Tue, 07 Feb 2012 17:56:27 -0600; 4min 41s ago
	Main PID: 27711 (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/zramswap.service

So it’s all up and running, lets check the syslog;


dmesg |tail -6

[36718.312713] zram: module is from the staging directory, the quality is unknown, you have been warned.
[36718.313228] zram: Creating 4 devices ...
[36718.339202] Adding 962476k swap on /dev/zram0.  Priority:100 extents:1 across:962476k SS
[36718.340959] Adding 962476k swap on /dev/zram1.  Priority:100 extents:1 across:962476k SS
[36718.342805] Adding 962476k swap on /dev/zram2.  Priority:100 extents:1 across:962476k SS
[36718.346567] Adding 962476k swap on /dev/zram3.  Priority:100 extents:1 across:962476k SS


Before activating the service
free |grep Swap
Swap:      6296572          0    6296572

After activating;
free |grep Swap
Swap:     10146476          0   10146476

There you go some ram based swap if you need it…