RAM up Your SWAP for Improved Stability

stick of ram

Clearly, the order of the day is to RAM your machine up to the hilt, but enhancing the use of the swap file can also be a benefit. Here's how, using Swappiness.

Why? Because ..

Computing can be very RAM-intensive. Say, you are running a graphics editor, a web browser or two, office apps and, who knows, maybe even a video editor.

Then there's AC-DC playing in the background .. 😉

Setup Unmanaged VPS (4 Noobs!) ... with vpsBible
Secure WordPress. Properly. ... with wpCop, the platform's dedicated security website
Olly 'the_guv' Connelly's vpsBible.com site and 'WordPress 3 Ultimate Security' book.

Check Your Swappiness Value

The lower the value, the longer it takes for swap to kick in. Of a scale of 0-100, the default is 60. Check yours:-

By way of a contradiction, Ubuntu's official swap guide – and if you are reading this you should also read that – recommends a way lower value, of just 10, to allow for quicker swap access. While there is no one-size-fits-all, have a play with various swappiness values.

To change the default, open:-

Search for this:-

Swap the value to this:-

.. and that takes effect after a reboot.

vm.swappiness=60 Doesn't Exist

You opened the sysctl.conf file and vm.swappiness wasn't there? Very possible.

Just scroll to the bottom of the file and add your swappiness parameter to override the default, so paste:-

Change Swappiness Value Without Reboot

This is handy to try different values without having to reboot each time.

To change the swappiness value for the current session only, or until you change again the value, type:-

.. where you want to try the value of 10, for example.


About the Author:

Olly Connelly (yeah, that's me) blogs at guvnr.com, polices WordPress security at wpCop.com and helps noobs build web servers at vpsBible.com, so if you've got sleeping problems you know where to come.


  1. the_guv  March 18, 2012

    Hi Andy, sorry, never saw this but I guess by now you’ve worked that out.

  2. andy  September 4, 2011

    Hi guv,i have a dv9702ea from hp,im using windows vista ultimate dual booted with linux mint julia being the guest os.im using it with 2GB of ram,my swappiness was 60 and ive changed it to 10.will this swappy apply to both my oses installed or just the linux mint julia?can you recommend the best value if poss?thanks.

  3. the_guv  October 24, 2010

    thanks Curt

    @Don. Whether or not you need to repartition depends on what partitions you have in place but, unless you have an OS running virtual OSes within using, say, VirtualBox, you will need one partition per OS (multi-boot).

    HAVING BACKED UP STUFF, you could change partition sizes, add partitions and more using the partition tool that’s bundled with the Ubuntu installer, else burn a great partition manager called gParted to disk and run that on a fresh boot to manage partitions. Personally, I don’t bother with dual or multi-boots any more, I just run Linux as my main machine with VirtualBox (search this site for tutorials) within and call up Windows or whatever when I want it (you could do the opposite, with Windows as the main OS and virtual Linux).

  4. Curt Corum  October 21, 2010


    This was a very useful howto…

    In combination with some thread on virtualbox vm.swappiness=10 has speed up my guest os dramatically!

  5. Don Rose  August 17, 2010

    I have a very current release of Linux Ubuntu and it said you do not need to repartition to install. It failed to install. So I need to know how to shove the WinXP partition over, decide how much space is needed for a minimal Ubuntu partition. Then create the new partition to install. Also in the past people told me I needed additional software to move between the partitions. I don’t think that’s true. The last time I tried this was before Ubuntu had a graphics interface. So I neeed very basic info to do this task.

  6. the_guv  March 3, 2010

    good to hear Pete

  7. Pete  March 1, 2010

    Thanks a lot! Now even an old Pentium IV with only 256 MB RAM, runs pretty well on Ubuntu 9.10. 🙂

  8. the_guv  February 18, 2010

    @James .. I’d tend to agree .. thank you.

  9. James  February 17, 2010

    Wow… I don’t think this makes too much difference to a newer computer, but on my family’s older computer this setting made all the difference in the world! Thanks!

  10. the_guv  February 6, 2010

    @James .. pleased to help, good to hear, tx

  11. James Adams  February 4, 2010

    Thanks! Well Done. I am running Karmic Koala on a Compaq Deskpro PII450/100 with 256mb ram, Seagate Medalist 10232 10gb HD, Western Digital 35100 5gb HD, Nvidia Geforce MX-4000 128mb Video Ram. So the swap file was slowing everything way down. Thanks Again, james

  12. the_guv  November 5, 2009

    @Tony .. thank you, appreciated .. quite right, was wrong way round, now corrected 😛

    nice point you make .. and a nice, handy site you have, BTW.

  13. Tony Maro  November 4, 2009

    I think you may be mistaken…

    You state that a higher number means it “takes longer for swap to kick in” but the reverse is actually true. The higher number means swap is much more likely to be used. Setting the value to 10 means it’s much less likely to use swap.

    However with today’s systems having 4 or 8 or more GB of RAM, the lower number is definitely better and will result in better performance because less of your apps get swapped to the hard drive.

    So, the more ram you have, the lower you can safely set this number (all the way to zero even.)

Add a Comment

  1. Swappiness.- Cambiar el intercambio entre la swap y la RAM « Travesuras  July 13, 2011
  2. Configurar el uso de memoria de intercambio en Linux  January 14, 2010
  3. Configurar el uso de memoria de intercambio en Linux  November 21, 2009
  4. Configurar el uso de memoria de intercambio en Linu  November 20, 2009