welcome to the world of…

Looks like a small bulb used to indicate something unusual, like a malfunction.

Hibernation and turning swap off

Filed under: Uncategorized — Tags: , , , , , — admin @ 2014-07-07 09:20

Having 16 GB RAM today is nothing extraordinary. Swap seems to be a useless thing. And it perhaps is. Even if you are able somehow fill up those gigs of memory then it is caused probably by some extremely hungry program which will initiate a horrendous swapping and your system will become virtually frozen.

Easiest solution is to have ho swap partition or no swap entry in /etc/fstab. But the hibernation will not work.

First step – turn off swap on boot – add “swapoff -a” to /etc/rc.local.

Then you need to turn on the swap before hibernation and turn it back on resume. Create a file /etc/pm/sleep.d/01_swap with content:

case "${1}" in
        echo 3 > /proc/sys/vm/drop_caches
        swapon -a

        swapoff -a
        service preload restart

Dropping caches is a good way to really minimize amount of data written to swap. My experience tells me that the drop speeds the hibernation up. I also use preload program for faster programs starting after fresh boot. It is necessary to restart it after resuming.

And remember that you need bigger swap then your RAM!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.