We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,272 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to change the swappiness of a linux box

Hi all

I want to change the swappiness of my linux server.Its running nginx as front alongside with cpanel
Based from tutorials i added vm.swappiness=90(to change default value from 60 to 90) in sysctl.conf and i reboot the server

However when after reboot is done i did cat /proc/sys/vm/swappinessand the value is STILL 60

My server is a VPS

Need urgent help

2
Contributors
4
Replies
1 Hour
Discussion Span
9 Months Ago
Last Updated
5
Views
Question
Answered
Khav
Junior Poster
103 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Besides sysctl.conf you have to edit /proc/sys/vm/swappiness, just replace with 90. Then you can use sudo swapoff -a and sudo swapon -a to load the new value without rebooting.

cereal
Veteran Poster
1,145 posts since Aug 2007
Reputation Points: 344
Solved Threads: 222
Skill Endorsements: 22

Thanks cereal bro

But i get permission denied when i tried to edit /proc/sys/vm/swappiness

I am login as root user , i tried both by ssh and ftp

Khav
Junior Poster
103 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

That can happen if you run a command like this one:

sudo echo "90" > /proc/sys/vm/swappiness

So, try this:

echo "90" | sudo tee /proc/sys/vm/swappiness

If you still get an error then check file permission, user and group:

ls -l /proc/sys/vm/swappiness

and post back here, maybe someone else will give you a better support. Bye!

cereal
Veteran Poster
1,145 posts since Aug 2007
Reputation Points: 344
Solved Threads: 222
Skill Endorsements: 22

Permission
-rw-r--r-- 1 root root 0 Jul 31 18:07 /proc/sys/vm/swappiness

Hope someone will be able to help me out

Khav
Junior Poster
103 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 9 Months Ago by cereal

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0734 seconds using 2.68MB