Decrease the Swap Use

I had problems with Linux Mint, the screen would freeze and I would have to hard reboot (see: I decided to give Ubuntu 10.04 at try. I ended up still getting the same problem.

The solution came when I discovered that with relatively low RAM memory, Ubuntu accesses the hard disk too much. This can cause, and did cause in my case, the video to fail. The answer for me was to decrease the swap use. Swap is a separate partition for virtual memory on the hard drive.

Here is the fix that I found for Ubuntu, I also tried it on Linux Mint 13 (main edition) and it worked as well. [I am currently back using Linux Mint, my desktop of choice.]

The use of swap is determined by a setting. The lower the setting number, the longer it takes before Ubuntu starts using the swap. The default setting is 60, on a scale of 0-100. This is too high for normal desktop use.

You can check your current swappiness setting by going to the terminal and copy and paste the following and then press enter:
cat /proc/sys/vm/swappiness

The result should be 60.

To change this, we need to install the applications gksu and gedit (if it is not already installed). Go to the terminal, and copy and paste the following and then press enter:
sudo apt-get install gksu gedit

You will need to enter your password.

To change the swap setting, copy and paste the following and then press enter:
gksudo gedit /etc/sysctl.conf

It will open of a text file, scroll to the bottom of the page and add the following parameters to override the defaults. Just copy and paste the following lines:
# Decrease swap usage to a workable level
# Improve cache management

Save and close the text file and reboot your computer.

After you reboot, you can check the new swap setting by opening terminal and then copy and paste the following, then press enter:
cat /proc/sys/vm/swappiness

I should now be set at 10.

If your RAM is less than 1 GB, you might want to set it even lower, like at 5.

Published by

Jay Forrest

Jay N. Forrest is an IT professional, an ordained Humanist minister, and a Certified and Accredited Meditation Teacher.