Showing posts from December, 2015

Add Swap Memory

You can add Swap memory in the server through creating a swap file. Determine the size of the new swap file in megabytes and multiply by 1024 to determine the number of blocks (here adding 2 GB to Swap): When you add a swap file, you leave existing alone, just swapon a new one. # dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152   [bs=block size, count= 1024*2048(2gb)=2097152] # mkswap /swapfile1 # chown root:root /swapfile1 # chmod 0600 /swapfile1 # swapon /swapfile1 Now verify the added Swap memory : # free -m  # cat /proc/swaps  Notes:  1. No need of swapoff, if you swapoff the existing swap you can crash the host, because may be the system have not enough memory to take over the current swap in use. (always make sure RAM is free before going to do swapoff -a). 2. Making swap space changes persistent As with filesystems, changes made by swapon are not persistent; to have swap added at boot time, create a line in /etc/fstab like this: /dev/sdb2 /swapfil