Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your server from 1GB to 2 GB, but there is only 2GB of swap space. It might be advantageous to increase the amount of swap space to 3GB or 4GB if you perform memory-intense operations or run applications that require a large amount of memory.
We can do it in two ways:
- add a swap partition
- add a swap file.
It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.
Create a new partition or Logical volume, based on your environment
lvcreate -L 2GB -n swap_lv appvg
Now make that partition or LV as swap space.
Now turn on the swap on that LV or partition.
Now this partition is added as swap space.
free -mcat /etc/swaps
To enable it at boot time, edit /etc/fstab to include:
For Creating the swap file and add it to swap space, see my earlier post here
Please don't forget to post your comments on this..