Increase Swap Space

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.

dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576
/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.

/swapfile1              swap                    swap    defaults  0 0

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.

  • create swap space, increase swap space
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

cPanel License Key Update command

To run the cPanel License Key update script (perhaps if you've upgraded from a trial license, or...

Common cPanel Commands List

Most Common Linux Cpanel Commands for Server Admins & Cpanel Users .Limit webuser...

Basic Linux Commands

Common Linux commands Note: To execute a command, enter the command with any options or...

Linux- Commands-GIST

Access Control exit - terminate a shell (see "man sh" or "man csh") logout - sign off;...

Understand more about vmstat

vmstat (virtual memory statistics) is a computer system monitoring tool that collects and...