I decided to give it a try, and the result on my desktop with a quad-core CPU and 2Gb of RAM was fantastic: 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! Surprisingly, I got almost the same results on a 6-year-old laptop with Pentium M and 1Gb of RAM! So, I've improved the script to automatically adapt to the amount of memory in the system and automatically scale across several CPUs or CPU cores, packaged it in .deb and uploaded to PPA.
- Sergey Davidoff
This is especially useful for netbooks, old computers (or computers that don't have too much RAM), virtualization or embedded devices but of course, you can use it on any computer.
To install Sergey's script in Ubuntu 11.04 or 11.10, use the following commands:
sudo add-apt-repository ppa:shnatsel/zram
sudo apt-get update
sudo apt-get install zramswap-enabler
Update: there is now a zram-config package available in the official Ubuntu 12.04 and newer repositories, which does the same thing. Install it using:
sudo apt-get install zram-config
Update:
- For Fedora 15+ (which uses systemd instead of upstart), see: Enable Zram in Fedora
- For Arch Linux, see THIS comment (script converted to rc.d).
More about compressed caching for Linux:
- http://code.google.com/p/compcache
- http://weirdfellow.wordpress.com/2011/05/04/compressed-ram-with-zram/