Operating System - Linux
1839533 Members
2401 Online
110146 Solutions
New Discussion

Swap is not used in RHAS 4.0

 
Adithyan
Frequent Advisor

Swap is not used in RHAS 4.0

Hi,

My server is : Red Hat Enterprise Linux AS release 3 (Taroon Update 5)
Hardware is Manufacturer: HP
Product Name: ProLiant DL580 G3

kernel : 2.4.21-32.0.1.ELhugemem

The out put of free -m command is shown below

total used free shared buffers cached
Mem: 12045 12026 19 0 139 11525
-/+ buffers/cache: 361 11684
Swap: 23173 0 23173

Why the server is not using the Swap memoy even after the physical memory is almost full. The same server has recently got hung and we had to restart it.

Can anybody help in this case ?
Keen to learn HP UX
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Swap is not used in RHAS 4.0

Shalom,

Try adding a new swap space.


---scraped from an oracle doc ----
To add swap space, perform the following steps:

1.

Open a terminal window and log in as root user. Check the id of the logged-in user. To verify and make changes to the kernel parameters, you should be logged in as super user (root).

Move your mouse over this icon to see the image


2.

Check the current availability of memory and swap space by using the free command. You might see different figures than those given in the screenshots.

Move your mouse over this icon to see the image


3.

Note that the system has around 1 GB of total memory and 500 MB of swap space. As per the installation guide, for better performance, it is recommended that swap area should be at least 1.5 or 2 times the total memory. To find whether you have sufficient free space on the disk to increase the swap area, issue the df -m command.

Move your mouse over this icon to see the image


4.

As shown above, there is 4561 MB (around 4 GB) of free space available. Create a swap file by using the following command:

dd if=/dev/zero of=/bigswap bs=1k count=1548576

Note: Name = /bigswap, Block size = 1 KB and File size 1.5 GB.

Move your mouse over this icon to see the image


5.

Change the access rights of the file by using the chmod 600 /bigswap command so that others do not accidentally delete the file.

Move your mouse over this icon to see the image



6.

Use the mkswap /bigswap command to make this file a swap file.

Move your mouse over this icon to see the image



7.

The next step is to enable swap on to the designated file by using swapon /bigswap command.

Move your mouse over this icon to see the image



8.

Check whether the swap space is added by using the free command.

Move your mouse over this icon to see the image



9.

Finally, choose the editor of your choice and add an entry in the /etc/fstab file as shown below to ensure that the new swap file is available after you reboot the machine. After adding the entry, save and close the file. So next time you log in, the system will read this file and use the /bigswap file to increase the swap space.

Move your mouse over this icon to see the image

Note: This is not a mandatory step.


-------------

Take a look at /var/log/messages and dmesg and see if swap is even activated.

SEP

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor

Re: Swap is not used in RHAS 4.0

Well.. Isn't that interesting...

The fact that a number shows up in the swap columns shows that swap is turned on, and is available.

What is the difference between the 'SwapTotal' and 'SwapFree' values in '/proc/meminfo' ? My bet is something like 200K.

Also, the sheer value of swap.. 23GB.. Is this all in one partition, or in multiple parts?

There was a post recently on this forum which discussed the maxiumum swap sizes, and how best to split them up.. Let me see if I can dig it up..

*rifles around* ah, here we go..

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1114456&admit=-682735245+1179102509755+28353475

Which points to:

http://www.redhat.com/magazine/017mar06/departments/tips_tricks/

Which states:

--
Red Hat Enterprise Linux 3 and higher supports larger swap partitions, each can be of maximum size set by the file size limit and the block device limit for swap partitions on that platform. Red Hat Enterprise Linux 3 has a 1TB limitation as maximum size of block devices, so it's 1TB.

While larger swap partitions are permitted, one large swap partition could affect system performance. For better performance it is recommended to split swap space to multiple discs. Separating swap partitions to different disk could reduce the load on a single disk.
--

So, that shouldn't be the issue.

So this really leaves the one concept..

*ponders*

11GB of 'cached' means that there's alot of 'play' room in the memory.

Whilst there is only 19MB available memory, in reality it's about 11.6GB (Cached + Buffers + Free).

Before swap will readily be used, it will first exhaust cache and buffers (which speed up IO read/writes etc.).

As you've got plenty of that available, there's no need to use massive slabs of swap.

That being said, if you do a little math here, there's only about 360MB memory in actual use for programs. The rest is IO buffers and caching.

Speedy ;)

So, simple answer: Don't fret! You're system is REALLY happy.

Now, as for the crash.. In the subject, you say AS4, but in the post you say AS3. Given Taroon and the kernel revision, we are talking 3.

You're at least 4 kernel revisions old. There's 2.4.21-47.0.1.EL available. Are other packages similarly not updated?

Also, are you running the PSP?
One long-haired git at your service...
Ivan Ferreira
Honored Contributor

Re: Swap is not used in RHAS 4.0

I think that is probably because most memory is used for buffer/cache, and not for applications. That means that if an applications need memory, buffer/cache information in memory will be flushed and given to applications.

See also:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1029490
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
dirk dierickx
Honored Contributor

Re: Swap is not used in RHAS 4.0

there is nothing to swap. linux will not use swap unless it has no choice (simplified).

you have enough free RAM, so why should it be using slow disk memory?
TANHM
Advisor

Re: Swap is not used in RHAS 4.0

Yes, what ivan explained was correct.....In linux it is normal to see the physical memory to be take up almost full..
You sure check the page in and page out...if there is high usage/utilization, then it will start to use swap.....you can use iostat to check this page in and page out...

Thanks