Hi
I need to reduce the swap assigned to a server from 244 GB to 2 GB, on a SLES 12.4 server.
When the database on this server is online, the swap is use, and cannot be unmounted. I stopped the database, and started the swapoff in yast. After 4 hours the swapoff was still busy executing.
On OS level I could see the swap reducing at a very slow pace using “free -m”. After 4 hours the swapoff process was still very busy, and 90 GB swap was still assigned - counting down at a very slow pace. But the downtime window was over and I had to kill the swapoff process. This undid the operation, swap assigned is back at 244 GB.
Is there another method to execute the swapoff faster?
Thanks,
@“willem.lourens” Hi, that’s a lot of swap:) So the swap is just a partition, not a backing device or anything special? It should not matter if just discarded?
You can see what is being used via;
cat /proc/meminfo
What is the output from;
swapon -s
I would look at creating a smaller swap file eg 2GB (if not able to create a partition) and set the priority see man 8 swapon
so it switches over to the other one.
Also if reducing to such a small amount, perhaps investigate the swappiness sysctl setting and reduce, so it uses the system RAM and less swap may help reduce until you can remove.
For example;
cat /etc/sysctl.d/98-server.conf
vm.swappiness=1
vm.vfs_cache_pressure=125
You will need to read up on the values, but this can be tweaked on the fly, the above conf file is so it sets up on boot.
Dear @malcolmlewis
Yes only a huge swap partition, not sure what will happen if it is just discarded.
Many thanks for your answer. I will have the opportunity to make changes again after month end, will confirm.
Kind Regards,
Dear @malcolmlewis
“cat /proc/meminfo” showed a huge amount of swap in use. I changed the swappiness to 10 a week before the next attempt, and created the 2 GB swap file with a higher priority.
Over the weekend I could let the swapoff command run overnight. The next morning it was hanging still. I restarted the server, and this time the swapoff executed successfully.
Many thanks for the comment