Check Swap Space in Linux

Revision as of 01:40, 8 January 2016 by Kipkis (Kipkis | contribs) (importing article from wikihow)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Linux uses Swap Space to back its physical memory with an overflow area. In most cases the suggested amount is a disk space equal to the amount of physical memory you have installed.

Below, we'll check to see how the swap is defined and being used by your system.

Steps

  1. From your root userid, enter the command "swapon -s". This will show your allocated swap disk or disks, if any. Your output should look like the following:
  2. Enter the command "free". This will show both your memory and your swap usage. Your output should be similar to the following:
  3. In either of the above, look for the used space, compared to the total size. If a large percentage of the swap space is used, then one of two actions may be warranted: you may want to either add an additional swap disk to increase the available swap space, or you may want to add additional physical memory to the system.

Tips

      • You can also see your swap disk(s) by using the "mount" command, but it won't show the allocated or used space.

Warnings

      • Adding more swap isn't always the answer. Using swap means that you're over-committed on physical memory, and swapping takes time. This takes its toll on your system's performance. If you're swapping, and having performance problems, more memory may be the real answer.

Related Articles