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

Dani AI

Generated

Short summary and practical next steps.

You already did the two obvious things: put the swappiness key into your sysctl config and reboot (reported by ), and correctly pointed out the classic sudo+redirection pitfall. There are two remaining possibilities to explain a persistent 60 and a continued "permission denied": (A) your write attempt used a shell redirection under a non‑privileged shell, or (B) the VPS host/kernel prevents container guests from changing that vm parameter (common on container systems such as OpenVZ).

Quick checks and how to try a change safely

# show current numeric value
sysctl -n vm.swappiness

# change it temporarily (replace <value> with the number you want)
sysctl -w vm.swappiness=<value>

# reload persistent sysctl files after editing (if you can)
sysctl --system

If the first command works but the second fails with EPERM, you hit a capability/virtualization restriction. If both succeed, the third command will confirm persistence after editing the appropriate sysctl files.

Detect whether the VPS enforces the setting

# quick guest/virtualization probe (may not exist on older systems)
systemd-detect-virt

# fallback: scan dmesg for virtualization hints
dmesg | grep -i virtual

If the guest type looks like a container (OpenVZ/vzlxc/container), the host often controls vm.* knobs. In that case you cannot reliably change swappiness inside the VPS.

What to do if you are blocked

  • If the kernel is host-controlled, ask your provider to change the node setting or request a full VM (KVM/QEMU) with kernel control.
  • As a workaround, reduce memory pressure on the guest: tune Nginx/PHP-FPM/cPanel memory settings and cache sizes so swapping is unnecessary.
  • Use the tmp checks above, report outputs to the host, and reference 's note about elevation when you show how you tried to write the value.

Caution: swappiness affects how aggressively the kernel swaps; higher values increase swap use and can hurt interactive latency. Adjust and measure.

Recommended Answers

All 4 Replies

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.

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

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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.