1822125 Members
3931 Online
109640 Solutions
New Discussion юеВ

How to Increase the swap

 
John CLARK_5
Frequent Advisor

How to Increase the swap

Dear friends,

I have Redhat linux ES 3,and i want to increase the paging space,how can i increase it?
what's the command to know the current swap?

Thank's a lot.
Best regards.

4 REPLIES 4
Stuart Browne
Honored Contributor

Re: How to Increase the swap

To find out what swap is currently available, you can do any of the following commands:

swapon -s
grep SwapTotal /proc/meminfo
free

To make additional swap, you have a few choices. If you are using LVM, and you have some physical extents free, you can create a new logical volume, and 'mkswap' it.

If you have any physical disk space available, you can create a new partition (using 'fdisk', setting it's filesystem-type to 'swap' (82)), and then use 'mkswap' on it.

Or if you have neither of those, and just some free disk space, you can create a paging file using 'dd', and create a virtual-swap-file using that (see 'man mkswap' for more details).

Either way, make sure you add the '/etc/fstab' entry to automatically add it upon boot-up.

Good luck!
One long-haired git at your service...
Sergejs Svitnevs
Honored Contributor

Re: How to Increase the swap

to see how much swap space you already have:
swapon -s

to increase your available swap space with a swap file:

check out the following link:
http://enterprise.linux.com/enterprise/05/03/02/2250257.shtml?tid=129&tid=42

Regards,
Sergejs
Gopi Sekar
Honored Contributor

Re: How to Increase the swap


use free command to find out current swap size on your system.

To add swap, there are two ways:
* If you are having free partition, then set it to type swap using fdisk and format it using mkswap. To add this in to swap space, you can use swapon

To make it permanent add this entry in /etc/fstab, like:

/dev/device swap swap defaults 0 0

if you dont have any free partition, then create a block file using dd command (check man mkswap for more details on this) and use this file as swap. you can add this into /etc/fstab to make it permanent.

Hope this helps,
Gopi
Never Never Never Giveup
Steven E. Protter
Exalted Contributor

Re: How to Increase the swap

Performance note on swap.

Increasing swap beyond 2 time memory will negatively affect overall performance. If you are already at this level, the real answer to memory shortage issues is to increase memory, not swap.

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