Skip to content

loxdegio/SystemdZramService

 
 

Repository files navigation

zram for systemd

zram compresses swap partitions into RAM for performance.

You need Linux kernel version 2.6.37.1+ to use zram.

Manual Install

There are 4 files you need to enable zram for systemd. They are:

  • zramstart
  • zramstat
  • zramstop
  • zram.service

All these files can be found in the project folder.

Place "zramstart", zramstat and "zramstop" in the following folder.

__/usr/sbin__

Place "zram.service" in the following folder.

__/lib/systemd/system__

Place "zram" in the following folder.

__/etc/sysconfig__

As root, run the following command to enable zram for Fedora.

systemctl daemon-reload

Starting

sudo systemctl enable zram.service
sudo systemctl start zram.service

Run the following command to make sure the service started properly.

sudo systemctl status zram.service

The output should look like this:

zram.service - Enable compressed swap in memory using zram
    Loaded: loaded (/lib/systemd/system/zram.service; enabled)
    Active: active (exited) since Sun, 02 Oct 2011 22:46:31 -0400; 44min ago
    Process: 942 ExecStart=/usr/sbin/zramstart (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/zram.service

To see how well your compressed swap performs run

zramstat # no sudo needed

The output looks like this:

/dev/zram0:     362.18% (180998144 -> 49973309)
/dev/zram1:     356.50% (180924416 -> 50749160)

This means 180,998,144 bytes got compressed to 49,973,309 bytes. The "swapped" memory is 362.18% of the RAM used. That's it!

Credits:

The zramstart and zramstop scripts were written by Sergey Davidoff of Elementary OS. The zramstat script and RPM packaging bits by Doncho N. Gunchev.

References:

About

Scripts that enable zram for systemd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 56.6%
  • Makefile 43.4%