Friday, April 13, 2012

Unix: Swap Size Increase




To check memory:
free -m
Sample output:
             total       used       free     shared    buffers     cached
Mem:          8105       1292       6812          0         38        483

-/+ buffers/cache:        770       7334
Swap:         1906          0       1906

Swap size increment helps to improve system performance. Suppose we are increasing swap size by 2GB.
dd if=/dev/zero of=/swap_file bs=1M count=2048

This will create file (swapfile) of size 2GB
mkswap /swap_file

add this file to your swap pool
swapon /swap_file

free -m
Sample output:
             total       used       free     shared    buffers     cached
Mem:          8105       1292       6812          0         38        483

-/+ buffers/cache:        770       7334
Swap:         XXXX          0       1906

To make it turn on at every bootup, open up /etc/fstab:
vi /etc/fstab
/swap_file none swap sw 0 0

 

No comments:

Post a Comment