swap partito size and verify if OS use it

General support questions
Post Reply
zio_mangrovia
Posts: 40
Joined: 2015/06/11 08:34:13

swap partito size and verify if OS use it

Post by zio_mangrovia » 2017/03/21 17:18:07

I don't understand what is best method to size swap partition.
Many years ago servers had few ram so swap dimension was mandatory but now ram is not represent problem especially in virtual environment.
I have cents 6.8-64 bit with 8 GB ram so how much swap memory I have to provide?
How can I verify if my system swap? In top command 'used swap' represent how much memory the system has already used or how much It's using at this time?!

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: swap partito size and verify if OS use it

Post by scottro » 2017/03/21 17:41:32

The recommendations for swap size have changed.

https://access.redhat.com/documentation ... d-x86.html

As for how much exists and how much is being used, you can use the free command


free -m to get megabytes and free -g to get gigabytes.

Code: Select all

 free -m
              total        used        free      shared  buff/cache   available
Mem:           7982         921        1509         122        5551        6555
Swap:          8189          12        8176
New users should check the FAQ and Read Me First pages

zio_mangrovia
Posts: 40
Joined: 2015/06/11 08:34:13

Re: swap partito size and verify if OS use it

Post by zio_mangrovia » 2017/03/22 07:01:52

I note 'top' command gives the same information of 'free' about swap area.
I think output data is dynamic information but in top I see always the same value about swap:

Swap: 1.572.856 KB
Used: 425.736 KB
Free: 1147120 KB

If the same values are shown for about 4-5 hours it's means server doesn't make swapping. But because OS doesn't free this area if It's doesn't use it?
When used area comes back to zero? I have to reboot server to free allocated memory for swap or there's automatic mechanism?

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: swap partito size and verify if OS use it

Post by TrevorH » 2017/03/22 07:30:02

Things get swapped out and will only be brought back in when they are used. If they're not used then they stay out. No point in wasting good RAM on stuff that isn't used.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply