1833792 Members
2337 Online
110063 Solutions
New Discussion

Increase SWAP

 
SOLVED
Go to solution
Lakshmikanth Baddam
Frequent Advisor

Increase SWAP

I have 418273 Kb of swap space how can i increase it any commands can help me..

# swapinfo
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4194304 1241176 2953128 30% 0 - 1 /dev/vg00/lvol2
reserve - 1323104 -1323104
memory 4182736 2557532 1625204 61%
# swapinfo -M
Kb Kb Kb PCT
TYPE AVAIL USED FREE USED
memory 4182736 2557532 1625204 61%
12 REPLIES 12
inventsekar_1
Respected Contributor

Re: Increase SWAP

depending on the requirement create a FS or device swap space. and configure it as swap usign swapon command...

write again little more clearly...what application are runnign, to what limit u want to increase the swap...whether u have extra separate disk..or u want FS swap???
Be Tomorrow, Today.
Victor BERRIDGE
Honored Contributor

Re: Increase SWAP

Hi,

The easiest way is to use SAM, but you would need some disk space available...


All the best
Victor
Jaime Bolanos Rojas.
Honored Contributor
Solution

Re: Increase SWAP

Lakshmikanth,

First make sure that your maxswapchunks value will allow for more swap.

Second if creating device swap you can use a command like this:

lvcreate -l (size) -n swap123 -C y -r n /dev/vgxx

Then enable swap:

swapon -p 1 /dev/vgxx/swap123

Make sure to add the entry in the fstab file

/dev/vgxx/swap123 /default swap pri=1

Regards,

Jaime.
Work hard when the need comes out.
Simon Hargrave
Honored Contributor

Re: Increase SWAP

Firstly I would use

swapinfo -tam

to give a better output from swapinfo.

Secondly, to add extra swapfile (you can't increase the primary swapfile without rebuilding the server) you need to create a new logical volume, enable it with swapon, and add it to /etc/fstab to it is reused on boot.

However you should investigate whether you actually need to add swap. Your output shows you have 4Gb of device swap and about 5Gb RAM (memory line generally shows about 0.75 x real RAM).

Now assuming you have pseudo-swap enabled (the swapmem_on kernel parameter) it looks like you probably do not need any extra swap.

However if you do need to add more you will need to ensure that maxswapchunks kernel parameter is sufficiently large to allow the extra swap space.
Simon Hargrave
Honored Contributor

Re: Increase SWAP

Also a note on swap priorities. If you add swap on a different physical device then you can set the priority to 1 same as primary swap. However if the second swap file is on the same physical disk then set it to priority 2 for example. Otherwise your disk drive heads will be flitting between the 2 swap files as the data is spread across the 2, greatly impacting performance.
Lakshmikanth Baddam
Frequent Advisor

Re: Increase SWAP

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 948 3148 23% 0 - 1 /dev/vg00/lvol2
reserve - 2310 -2310
memory 4085 1277 2808 31%
total 8181 4535 3646 55% - 0 -


Now here in the above output my swap space is memory-- 4085... or total -- 8181 what is Dev?
Victor BERRIDGE
Honored Contributor

Re: Increase SWAP

I forgot to add:
By using SAM, it will be aware of the values of maxswapchunks kernel parameter, and will inform you if you need modifying (it will give the values you need...) and you will have to compile a new kernel...
We cant give you more help since we do not know what you have (as kernel values that is...) and the size swap you want to add...

All the best
Victor
Lakshmikanth Baddam
Frequent Advisor

Re: Increase SWAP

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 948 3148 23% 0 - 1 /dev/vg00/lvol2
reserve - 2310 -2310
memory 4085 1277 2808 31%
total 8181 4535 3646 55% - 0 -


here i am confused...what is my virtual memory now is it
memory-- 4084 or

total --8181 ? do i need to take toatl field as my total virtual memory or the memory field as total virtual memory??
Victor BERRIDGE
Honored Contributor

Re: Increase SWAP

Well,
HOw much memory do you have on this box?

From what we see here with your swapinfo, is is only the value of your swap/pseudo-swap (memory used as swap).
The total of both gives you the total size of your virtual memory.
So here you have:
4GB of device swap
4GB of memory usable as swap
-----------
8GB total of virtual memory...
Jaime Bolanos Rojas.
Honored Contributor

Re: Increase SWAP


Lakshmikanth

# swapinfo -tam
Mb Mb Mb PCT START/ Mb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 4096 948 3148 23% 0 - 1 /dev/vg00/lvol2
reserve - 2310 -2310
memory 4085 1277 2808 31%
total 8181 4535 3646 55% - 0 -


Let's start from the bottom up:

The total line indicates the amount of swap that have been reserved ( not used ).

The memory line, indicates how much pseudo-swap have been used, this line is not to be confused with physical memory.

Reserved line, indicated swap that was separated in case is needed.

Dev, shows how much swap was actually used since the last reboot. We can see that the most that you have used is 23%.

Unless you are planning on running more intensive application(s), you do not really need to add more swap, and even if you do,
adding more swap would not be the right solution, but adding more memory and then if needed adding more swap.

For the moment I think you are just fine.
Work hard when the need comes out.
Lakshmikanth Baddam
Frequent Advisor

Re: Increase SWAP

Thnx alot jaime that's pretty clear to me now.