zRam is one of a number of technologies that are now integrated into the Linux kernel but turned off by default. It creates a solid block device inside of RAM that the operating system views as a swap partition. However, it’s compressed and stored in RAM pages as opposed to on an actual disk or NAND medium. This provides extremely fast I/O speeds as well as a reduced risk of system software swapping code out.
This technology originally appeared as part of the elementary OS distribution as compcache. If you’re an elementary OS users who now wants to bring compcache over to a DEB repository distribution, then zRam provides the same solution through the Linux kernel.pdate system. Ubuntu 12.04 and up have it loaded straight in the repository, as should many other distributions.
Method 1: Installing and Running zRam
If you’re uninterested in providing a custom configuration, then you can simply issue this command at the CLI prompt:
sudo apt-get install zram-config
This package actually contains a script that runs it as a service, so it automatically configures itself and sets the service to run automatically. No further configuration or input is necessary. If you really wanted to, then you could even install it through the Synaptic graphical package manager, since this would have the same end effect without the ability to view any resulting error messages. More than likely you won’t see any interesting output at all.
Method 2: Passing Configuration Options to zRam
That package only installed two functional files with a few pieces of documentation. One is at , and the other is at the location. Don’t edit that configuration file directly. Instead, issue sudo sudo service zramswap followed by an option. The options are as follows:
In most cases, these aren’t necessary to use whatsoever.