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
sudo service zramswap start|stop|status|restart|reload|force-reload
/etc/init/zramswap.conf
/etc/init.d/zramswap
DEBIAN
目录包含软件包元数据和初始化服务的命令。这就是软件包中的全部内容。相应的设备按照以下方案命名:/dev/zram[0-9]
你是通过 PPA 安装的吗?我建议你这样做。sudo apt-get install zram-config
进行安装。 - Sameer Puricat /proc/swaps
如果你有一个活动的交换分区/文件,应该会有一些/dev/XXX条目,并且至少有一个名称中带有"swap"的条目(我们系统上每个处理器核心都会有一个)。如果没有,请尝试重新启动并再次输入命令。
没有进一步的操作需要进行。
sudo apt-get install zram-config
sudo su
update-rc.d zramswap defaults
在我的Ubuntu 14.04 VPS上,我需要运行以下命令:
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install zram-config
sudo apt install linux-modules-extra-raspi