I installed zRam as described on webupd8.org. I installed it from the terminal. Is that all I have to do or do I have to do some configuration or something? Does the zram-enabler do everything by itself or do I have to set some parameters?
7 Answers
Here you go. Here is the whole tutorial about zRam in Ubuntu:
zRam is a code inside kernel, that once activated, creates a RAM based block device which acts as a swap disk, but is compressed and stored in memory, allowing very fast I/O and increasing the amount of memory available before the system starts swapping to disk.
zRam is integrated into the Linux kernel 3.2 and above, so it's included already in Ubuntu 12.04.
Previously on my 2GB machine, without zRAM, when i open lots of browser tabs, the system start choking, while HDD start copying data to SWAP causing a total slowdown. Now after activating zRam, instead of freezing after running out of RAM, the system worked like nothing happened. I didn't notice any difference at all. It looked just like adding more RAM ;)
From my experience, zRam is useful for people using computers with 1GB or 2GB RAM. Since zRam is compressing data, it require some processor resources. Not much, but always. For that reason i do not recommend to use it with old processors. Also if you have 4GB RAM most likely it won't be necessary to use it.
To activate it, type in terminal:
sudo apt-get install zram-config
To remove [type the following]:
sudo dpkg --purge zramswap-enabler sudo dpkg --purge zram-config
-
2
-
zRam is basically a tradeoff if you have too powerful CPU compared to the amount of RAM you have. It would have been better to invest less on the CPU and more on the RAM but if you already made the mistake, zRam can help. Oct 12 at 14:59
Like Sergey "Shnatsel" Davidoff was quoted in that blog post, this package installs a script to run it as a service. The script automatically configures itself and the service starts up automatically. There is no further configuration needed. The service can be manually controlled via:
sudo service zramswap start|stop|status|restart|reload|force-reload
If you open the deb package with file roller you can see that only two files are installed:
/etc/init/zramswap.conf
/etc/init.d/zramswap
Along with some documentation files. The DEBIAN
directory contains package meta data and commands to initialize the service. Thats all there is in the package. The corresponding devices are named after this scheme: /dev/zram[0-9]
Have you installed it via PPA? I recommend doing that.
-
Yes I did install it via PPA. And thanks for your answer. You answered my question perfectly. So I dont need to start it every time i switch on my computer right? It starts up automatically right?– SteigerAug 11, 2012 at 19:21
-
-
1In Ubuntu 12.04+, it is now available via
sudo apt-get install zram-config
Jan 30, 2017 at 3:53
The service daemon will activate instantly upon install. You can verify this by typing in a terminal:
cat /proc/swaps
There should be some /dev/XXX entry (given you have a swap partition/file active) and at least one entries with "swap" in its name (there will be one for each processor core on our system). If not, try rebooting and type in the command again.
There are no further actions neccessary.
Starting with Ubuntu Precise, there is an official upstart script for Ubuntu by Adam Conrad to configure zram in the main repository:
sudo apt-get install zram-config
Source: http://gionn.net/2012/03/11/zram-on-debian-ubuntu-for-memory-overcommitment/
Make sure to reboot
Ubuntu and check if Zram started during boot.
Follow the instructions as noted earlier to check by cat /proc/swaps
If you don't see your zram swap devices listed, (in my case too) then do this :
sudo su
update-rc.d zramswap defaults
This will list zram as a startup service.
reboot
and check to see if it started during boot.
On my Ubuntu 14.04 VPS I had to run the following:
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install zram-config
The first line installs the zram kernel module.
Note that in Ubuntu 21.10 the zram module was removed by default (on Raspberry PI) to decrease the size of initramfs. As a result you need to take an extra step to enable zram on a Raspberry PI:
sudo apt install linux-modules-extra-raspi
See also: no longer works on ubuntu 21.10 (raspberry pi 4) #71