вторник, 8 ноември 2011 г.

How to enable/disable/empty the swap

This post was intended for my blog http://linuxtricksandtips.blogspot.com/ but for some unknown reasons ended up here. I won't delete it, but all the guys coming here from a search, feel forwarded. :)

My Sabayon seems to have the habit of writing stuff into the swap and then forgetting about them. So I thought for a while, why not just empty the swap when it's full and I'm sure nothing is using it. Well, it turned out it's possible to do so. Thanks to this forum post, now I know how.
So, there are the commands:
$swapoff
$swapon
which can be safely used to turn on and off the swap. Now, the source site suggests using "$swapoff /dev/hdxx" but if you have only one swap partition (like I do) this is unnecessary.
All you need to do is (as sudo, of course):
$swapoff -a
and after it finishes emptying your swap,
$swapon -a
And it's done. You have a fresh swap file, which you can start trashing immediately.
Now, if you do that when a program is still writing to the swap, I don't know what will happen. Maybe something ugly, maybe not. I tested it when nothing was using the swap even though my ram was almost full, and I haven't noticed any problems for now.
Enjoy!

петък, 15 април 2011 г.

New domain

A little notification to all the users of http://kindlenookorsony.wordpress.com that the blog changed domain and now can found on http://www.kindlenookorsony.com .  I can't say how extremely glad I am to escape the rules of wordpress.com. Now I can do to my site whatever I want. Cheers.