Monday, October 03, 2011

Enable Zram in Fedora

zram compresses swap partitions in RAM for performance.

What follows are instructions on how to enable zram for Fedora. You need Linux kernel version 2.6.37.1 or better with zram compiled as a module.

Run the following command to see if you have zram available as a module in your kernel.
modprobe zram  

If the above command runs without errors, you have zram available as a module in your kernel. If not, you need to rebuild your kernel to have zram compiled as a module. Refer to these instructions, here, to learn how to compile a custom kernel for fedora.

There are 3 files you need to enable zram for Fedora. They are:
  • zramstart (Bash Script)
  • zramstop (Bash Script)
  • zram.service (Systemd Service File)
Get these files from here.

Place zramstart and zramstop in the following folder.
/usr/bin

Place zram.service in the following folder.
/etc/systemd/system

As root, run the following commands to enable zram for Fedora.
systemctl daemon-reload
systemctl enable zram.service
systemctl start zram.service

Run the following command to make sure the zram service started properly.
systemctl status zram.service

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

Congratulations, you now have zram enabled in Fedora.

0 comments:

Post a Comment