Hot Deals: Sweet Valentine Gifts at Sweet Prices | Amazon Kindle DX | Nokia N900 | Nokia E72 | Browse Full Store

Modify Your Swapfile For Better Performance

by Chinmoy Kanjilal | Translate | Print
Friday, 07th Aug 2009 | Share






Share Modify Your Swapfile For Better Performance on Twitter Share Modify Your Swapfile For Better Performance on Facebook Save Modify Your Swapfile For Better Performance To Delicious Favorites Stumble Modify Your Swapfile For Better Performance Share Modify Your Swapfile For Better Performance on Digg Get Instant Updates as RSS Feeds from Techie Buzz

A swap file is an area on your hard-disk where the computer continuously keeps storing data which is not in immediate use. Now, a drive failure of the swap partition can cause some applications which require high amount of swap memory to crash.

There are two workarounds to this :

  1. Firstly, you can reduce the system swappiness. With this, you can set the system to use less swap memory. The possible values are from 0 to 100.
    Just run the command :

    sysctl vm.swappiness=desired swappiness

    Here, replace ‘desired swappiness’ with a desired value between 0 to 100. 0 indicates no swap usage, thereby running everything on the RAM, unless absolutely necessary, 100 indicates immediate swapping.For this to take effect without a reboot, run

    swapoff -a

    and

    swapon -a

    as root.

  2. Using a swap file.
    Using a swap file has it’s own advantages. A separate swap partition has to be fully functional and error free at all times. Also, it eats up some time of the already slow Linux bootup process. With a swap file, you can adjust it’s size, So, to use a swap file, become root. Then follow the steps below.

    • Create an empty file with the command :
      dd if=/dev/zero of=/swapfile bs=1048576 count=1000
    • Create a swapfile :
      mkswap /swpf
    • Turn it on.
      swapon /swpf
    • Add the line
    • /swapfile    swap   swap  defaults 0

      to the file /etc/fstab for doing this permanently.

  3. Check the creation using :
    swapon -s

That is all. Get a better and faster debian based system in a few seconds, without any restart.

Liked this post? Have a Question? Comment and share your opinions and views with us

Get Regular Updates. Subscribe to Free RSS Feeds or Email Updates. Click to expand subscription options

No Responses so far | Leave Your Comments

Comments are moderated. Please try and stay on topic. Please do not use abusive language, if you think there is a problem, please email the post author or use the contact us form to tell us about it.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>





Better Tag Cloud