Linux Lite Forums
Changing Swappiness - Printable Version

+- Linux Lite Forums (https://www.freecinema2022.gq/forums)
+-- Forum: Software - Support (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=5)
+--- Forum: Installing Software (https://www.freecinema2022.gq/forums/forumdisplay.php?fid=18)
+--- Thread: Changing Swappiness (/showthread.php?tid=4899)

Pages: 1 2


Changing Swappiness - JanetBiggar - 01-30-2018

I'm trying to change the swappiness on an older computer from 60 to 10 and have always followed the following article section 1.1:https://sites.google.com/site/easylinuxtipsproject/3

However, this particular computer I upgraded to LL 3.6 and when I cut and paste the get leafpad line it says it is already updated and hence no file appears into which I can cut and paste the next line in the following step.

Is someone able to give me the steps to reduce swapiness to 10 given that this computer is running LL 3.6?

Thanks in advance.


Re: Changing Swappiness - Moltke - 01-30-2018

Hi [member=7067]JanetBiggar[/member]

To change swappiness, in a terminal type the following command:

Code:
sudo sysctl vm.swappiness=10

To verify changes run
Code:
cat /proc/sys/vm/swappiness

However, you'll have to run this command reboot after reboot. To make it permanent, type in a terminal:

Code:
sudo nano /etc/sysctl.conf
scroll to the bottom of that text file and add

Code:
vm.swappiness=10

Repeat the process to verify changes and that should be it.

Hope this helps! Smile


Re: Changing Swappiness - Artim - 01-30-2018

[member=6629]ralphy[/member] has a cool graphical tool for doing that too, called Unlockme.  It does all kindsa stuff in one very simple GUI.  Nice for lazy people, newbies, and technophobic kids.



Re: Changing Swappiness - JanetBiggar - 01-30-2018

Thanks Moltke I will give it a try tomorrow. This list is great, it’s so supportive which is indispensable to newbies like me.

The unlockme that random boy mentioned sounds interesting, however safer for me to do the specific steps Moltke mentioned at least for now  Wink


Re: Changing Swappiness - Moltke - 01-30-2018

[member=7067]JanetBiggar[/member]  I also found this article https://rudd-o.com/linux-and-free-software/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that and the author suggest to change swappiness to 1 by running this command:
Code:
sysctl -w vm.swappiness=1
It's supposed to do a better job than change it to 10, you could try that if that pc of yours is really short of RAM. The article also explains why to change swappiness default value, is a nice reading overall. Smile


Re: Changing Swappiness - JanetBiggar - 01-31-2018

Hi Moltke,
Well the temporary change to 10 works, however when I try the permanent line it does't work, however it may be that I'm missing a step.  When I put in the "sudo nano..." line I get a bunch of text, then I add the "vm swappiness=10" at the bottom and then I simply close the file.

I seem to recall in the very first link I mentioned above that I had to save the file...I tried to see if I could "save" the changes in terminal command line, but no choice to save.  I think I'm missing something.

I also tried the:
sysctl -w vm.swappiness=1
However I get this following message below the above command:
sysctl: permission denied on key 'vm.swappiness'

Not sure what to do.  I have RAM of 2GB so it not horrible so thinking 10 would be ok, but can't seem to get a permanent change to 10


Re: Changing Swappiness - Moltke - 01-31-2018

Hi [member=7067]JanetBiggar[/member]

Quote:I tried to see if I could "save" the changes in terminal command line, but no choice to save.  I think I'm missing something.
To save the file on nano press Ctrl+O, you'll be asked to save the changes made to the file, hit enter to confirm, then Ctrl+X to close.

Then type
Code:
$ cat /proc/sys/vm/swappiness
to verify the changes have been made.

Quote:I also tried the:
sysctl -w vm.swappiness=1

I think you should try with the sudo command
Code:
$ sudo sysctl -w vm.swappiness=1



Re: Changing Swappiness - JanetBiggar - 02-01-2018

Thanks for the steps Moltke, I gave it a go, but despite confirming that the file was saved with the change to swappiness of 10, after rebooting it still shows 60.

The temporary fix does work if that is helpful to know although as you mention this reverts to 69 once rebooted.

With a RAM of 2G will it make that much difference if I leave it at 60?



Re: Changing Swappiness - Artim - 02-01-2018

2 GB of RAM is better at 10 than 60.



Re: Changing Swappiness - Moltke - 02-01-2018

Hi [member=7067]JanetBiggar[/member]

Type
Code:
$ sudo nano /etc/sysctl.conf
and check if there's a "line vm.swappiness=60" in that file, if it does exists that might be the problem, delete it or comment it; add a "#" in front of it, then press Ctrl+O, hit enter to save changes and Ctrl+X to close nano.

Hope this helps! Smile