Scripts that enable zram for Fedora
Shell Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.project Add Eclipse project file. Mar 1, 2013

zram for Fedora

zram compresses swap partitions into RAM for performance.

You need Linux kernel version or better to use zram. For Fedora 16 you can just install kmod-staging from rpmfusion to get the module:

sudo yum install kmod-staging

Automated Install

First you have to setup your rpm build environment. For details see How to create an RPM package - Preparing your system.

# Short version of the howto
sudo yum install @development-tools fedora-packager

# the real thing(tm)
make rpm
sudo rpm -Uhv ~/rpmbuild/RPMS/noarch/zram-*.noarch.rpm

Manual Install

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

  • zramstart
  • zramstat
  • zramstop
  • mkzram.service

All these files can be found in the project directory.

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


Place "mkzram.service" in the following directory.


Place "zram" in the following directory.


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

systemctl daemon-reload


sudo systemctl enable mkzram.service
sudo systemctl start mkzram.service

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

sudo systemctl status mkzram.service

The output should look like this:

mkzram.service - Enable compressed swap in memory using zram
    Loaded: loaded (/usr/lib/systemd/system/mkzram.service; enabled)
    Active: active (exited) since Mon 2015-11-30 12:26:21 UTC; 2min 45s ago
    Process: 2437 ExecStart=/usr/sbin/zramstart (code=exited, status=0/SUCCESS)
    Main PID: 2437 (code=exited, status=0/SUCCESS)

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!


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