Jul 26th, 2009
How to increase swap space in a Linux server?
How to increase swap space in a Linux server?
It has been a common issue that in most of the cases the RAM gets upgraded after the server is live. For maximum utilization of the resources, it is recommended to create swap space of twice the amount of RAM. Hence if a RAM of 1GB is present in the server 2GB of swap space should be present. In order to create a swap space of 1GB.
/sbin/mkswap -c -v1 /swapfile1
/sbin/swapon /swapfile1
Add the entry to /etc/fstab to automate it after a Reboot. Edit /etc/fstab and add the entry below.
A new swap file can be created with new name replace the filename “swapfile1″ with a new one and follow the same procedure. The above commands are used to create 1GB swap. If the amount of RAM in the server is 2GB, then a swap file of 4GB is required.
The easiest way to create this swap file is to created four swap files of 1GB each.