Check the memory on your server
# free -m
total used free shared buffers cached
Mem: 8117 3204 4913 0 77 2648
-/+ buffers/cache: 478 7639
Swap: 101 0 101
Now say you need to increase it by 500 MB for your server, first locate a place you can spare this 500 MB in my case i found it in /u01
Use the dd command to create a swapfile
#cd /u01
# dd if=/dev/zero of=swapfile bs=1024 count=512000
512000+0 records in
512000+0 records out
# ls -ltr
drwx------ 2 root root 16384 May 1 2006 lost+found
-rw-r--r-- 1 root root 524288000 Nov 28 13:58 swapfile
Next issue the following two commands
# mkswap swapfile
Setting up swapspace version 1, size = 524283 kB
# swapon swapfile
Now check you memory again
# free -m
total used free shared buffers cached
Mem: 8117 2176 5941 0 45 1975
-/+ buffers/cache: 155 7962
Swap: 601 0 601
Here is your increased SWAP.
To make this change permanent add the line in your etc/fstab
/u01/swapfile swap swap defaults 0 0
No comments:
Post a Comment