EDIT: In precise there's now zram-config
. It's an upstart job compressing up to half of your ram spread over $(number of CPU cores) swap devices. It didn't allways start at boot but issuing sudo service zram-config start
works.
I enabled compcache="256 M" in /etc/initramfs-tools/initramfs.conf
as described here (by me :P). This - I believe - creates /dev/ramzswap0
but it is never enabled as swap. It works only after mkswap
&& swapon
.
Then there is the module zram that creates /dev/zram
. Is it something else? It works the same way but /dev/ramzswap
is created from the module ramzswap.
At the end of the day I wanna have a compressed swap in ram and use the better of the two and for that I need to know how to enable it permanently in a non hackish way. How is this done?
I wrote about ramzswap in Lucid here but things have changed in Natty. You can still enable ramzswap in initramfs.conf but it doesn't get activated.
P.S.:I scanned all udev rules in /lib and/etc but found nothing of interest.
I was struggling with the same problem.
Today I found an excellent blog post about it. http://weirdfellow.wordpress.com/2011/05/04/compressed-ram-with-zram/
Although "sudo start zramswap" didn't work, when I restarted my PC it solved my problem perfectly.
Try it.
There's now a PPA that installs a proper Upstart script for enabling zram at boot-time. It chooses the correct size and number of compressed swap devices for your system.
https://launchpad.net/~shnatsel/+archive/zram
Straight from the Debian wiki. For me, this is the easiest.
First, copy and paste this code into /etc/init.d/zram
Next, execute these two commands:
Finally, to add zram at startup:
Done.
Here's the cheap solution. Add the following line to
/etc/rc.local
, before theexit 0
: