Fix Zabbix Warning: Lack of Free Swap Space

In this article you will learn how to Fix Zabbix Warning: Lack of Free Swap Space, and manually clear swap memory in Linux.

The problem has 3 solutions, create or increase swap space, increase server RAM, and finally we can clear the swap manually.

What is Swap Space?

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.

Manually Clear Swap Memory

Check swap space in Linux using free

Before manually clear swap memory lets check free swap space using Linux command free:

# free -m

Example output:

In this example our system used only 12Mb of swap space.

Disable swap

Now time to disable swap:

# swapoff -a

It can take some time ~60sec, please wait until finished.

check swap linux

Enable swap

Then re-enable swap:

# swapon -a

Now swap space should be cleared.

Lets check again:

As you see there is 0Mb used space.

That’s It!


In short:

How to Clear Swap Memory Linux

  1. Disable swap

    # swapoff -a

  2. Enable swap

    # swapon -a

Discuss article in ArsTech Forum

   

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Leave a Reply