Linux Tip | Adjust Swappiness and Set Write Cache to Improve Perfomance

Video is ready, Click Here to View ×

Here’s how you adjust swappiness and activate write behind caching in Linux:


sysctl vm.swappiness

cat /proc/sys/vm/swappiness


sudo nano /etc/sysctl.conf

Add line: vm.swappiness = 10


Open Disks.

(Package name: gnome-disk-utility. Command: gnome-disks.)

Click ‘Drive Settings’ in menu.

Set ‘Write Cache’ to On.

Restart computer.

Please be sure to give EzeeLinux a ‘Like’ on Facebook! Thanks!…


  1. Teamviewer works great! For somebody change from Windows to Mint well not so fast. An older friend was using IE (imagine…) so I installed Google Chrome and voilà. Installed all her links etc. Now if can only find a free Cribbage game (GUI) for Linux that would do it LOL.

  2. @Joe Collins: This was an EXCELLENT walk-through! I'm a Linux Noob and people's instructions on websites were not granular enough for me. This was outstanding and very helpful! Thank you so so much!!!!!!

  3. PS have been using Linux for about 20 some years, just never messed with Arch that much. Have installed via command line, but I really like Antergos. Just cant remember about how to set Swappines. Thanks.

  4. My delayed update on the Linux Mint 17.3 swap prob: It appears that if you use the LM 17.2/3 install encryption option(s) … that the swap space is allocated & set-up, but "not available" and none of the fine tips that are included in this video have any effect. Plus + when you set-up or select the encrypt option the install restart hangs, stops or freezes just after the reboot … where you remove your CD or USB source … and never actually closes as it should. Install without the encrypt and all works fine. My LM 18 & Ubuntu 16 prob is still a problem for me, but apparently not the majority of Linux users. Any who thanks Joe for your videos.

  5. Joe, I recently upgraded to a SSD & installed Linux Mint 17.03 newly … now the System Monitor notes that Swap is "not available" /computer appears to run OK, but should I be concerned ? as there was a considerable amount of Swap going on with the original HD.

  6. You may also turn off a machine remotely if your baseboard have a baseboard management controller (BMC). you need to configure to talk to your remote machine and issue a reset/hardstop/hardstop remotely.
    Some high end server machines provide that support.

  7. I have run machines without any swap space. Did not really encounter issues in recent times with more memory. Years ago on limited memory, you did run risk of programs suddenly force quitting without it.

  8. Great video. Clear teaching. I like watching your videos. Thanks Joe. I use Clonezilla to do full drive backups. But could you do a video on just data backup and restore? How can I restore data on my computer after I do a complete and fresh reinstall of a Linux distribution on my computer?

  9. Never knew this or adjusted these settings – great job, Joe! I am
    fuzzy, but I think for my system I was told to turn off write cache due
    to how important the sql database was for my mythtv setup, but I might
    be wrong. When I was working on my click repair RT machine (video on my
    channel, real time click repair of vinyl records hooked up to my table),
    if it wasn't for rebooting via SSH, I would have worn out my legs while

  10. First of all thank you very much for all the helpful tips you give through this channel. I tried the tricks suggested in this video and yes i found that swappiness in ubuntu gnome 16.04 (the one i'm using right now) is 60. And then I changed swappiness to 10 as suggested, then double checked using "sysctl vm.swappiness" and found that it was reduced to 10. The problem is that I've got 4 gigs of ram in my laptop and the swap partition is 4 gigs (didn't mess with the system defaults while installing) and despite that fact, the system started to swap although i didn't reach the 90 % limit of memory usage. I checked using htop. And yes I restarted the computer after setting swap to 10. Any ideas will be much appreciated.

  11. Thanks for another great video, sir. This greatly improved the performance of my Pearl OS running in Virtualbox. I'll have to try it on my other machines to see if there is an appreciable difference in native hardware.

    Have you considered the possibility that a low swappiness factor could be affecting your system's ability to resume after going to sleep? Have you tried experimenting with higher swap usage to alleviate the problem? It was just a thought.

    I really appreciate your videos and I have learned a lot from you. Thanks so much.

  12. I am still a newbie. I have a high-quallity SSD with 480 GB. I have several distros on it, and playing with all of them using a boot-manager called rEFInd. Anyways, I had no clue what I was doing when I installed everything and have dozens of partitions and several swap partitions. I am sure my partition arrangement is clusterf**k. But it works. So do I need to set swappiness for each distro ? How do I get each distro to share the same Swap Partition ? And once I set swappiness to 10, how big does the Swap Partition need to be ? I think my main goal at the moment is to set my partition for the primary Linux distro to something like 80 GB, and then only set the test distros to something like 20 GB. But even that is over-kill. Right ?

  13. Hi, great video.
    I want to mention that I've set value of 40 for swappiness value on one of my computers with 2 GB or RAM. In my experience, swappiness value of 10 is good if you do something that does not require too much memory. But when I do several things that require a lot of memory. Then Linux Mint 17.3 Mate starts with some heavy swapping, and often it takes few minutes or more. And during that heavy swapping I cant do almost anything on my computer. With swappiness value of 40, I don't have such problems. Maybe some other value will give me better results, but I'm ok for now with swappiness value of 40.

  14. I'm giving this a go for one reason. To see if it improves the performance of the libreoffice suite. In particular the Base module. There has always been a problem with it freezing up especially during an edit, but the problem is getting worse. If i do not find a solution soon i will be forced to abandon Libreoffice for another option. Kexi may become my next database platform.

  15. @2:30. Ok. There is no such thing as " solid state hard drive". It's a solid state drive. Hard drive is the spinning disc drive of the 60's, 70's, 80's, 90's and early 2000's up until around 2009 and more recently when ssd's became actually affordable. I'm sorry to sound mean, but that had to be cleared up.

    FTR, though, I greatly appreciate this video and obviously gave it a thumbs up.

  16. Hi Joe great video on Swappiness.

    I just have a question a little confused about this. Is this the same thing as to when you create swap partition in Ubuntu based when installing. A little confused because i thought swap file had to be how much ram you have in your pc. So when you where saying used 60 just confused how that works. I have my swap partition 16GB because that's how much ram i using and its pretty good ram fast too. SO i just want to know if that 60 is this the same thing and how is that is the 60 less then 16GB. Just lost if you can help me understand. Thank you

    Another thing is talking about swap. I seem to have no idea how that is supposed to be used or if i'm actually using it. I know i have to make it on Ubuntu based every time but how exactly is this supposed to be used to get full extent of using it. I have heard that its good to have if something happens to your system you can get it back. But to me its just nothing to me its just there in way and i would like to use it and know all i can if you can help me understand this part of swap

    Thank you Joe hope you understand all my wording

  17. Suggestion…. Making backup copies of system config files is usually a wise precaution (in my book). In this case, I would have created a copy of "sysctl.conf" named "sysctl.conf.mmddyyyy" before making changes. ALSO…. Commenting changes in any config-file is always a good practice. 🙂

  18. A test by The Tech Report – "The SSD Endurance Experiment: They're all dead" showed the worst SSD starting to reallocate sectors, only after 100TB written. I think you can swap a long, long time, before SSD writes become an issue.

  19. FYI… All SSD's have a set amount of write cycles. The latest SSD generation lasts longer than the 1st gen-SSD's . IMO…. You will upgrade your SSD long before it has a write-fail (that is in a desktop setting). When I have created Linux Server setups with SSDs…. I have always used a dedicated standard-fast HD for the swap-partition and log-files, but only in heavy traffic and transaction cases like SQL Servers.

Leave a Reply

Your email address will not be published.