Thursday, 12 May 2011

File Method: Increase the SWAP capacity by using file method


now i want to increase swap 1.2G to 1.3G:

to see the swap location / status
    # swap -l                  // location
    s1
    # swap -s                 // status

1. to increase the SWAP capacity by using File Method
   1. # mkfile 100m /usr/swapfile
   2. # swap -a /usr/swapfile

now see the locaton;
# swap -l                      //now there are two files s1 + swapfile
s1
swapfile

# df -h (100mb added)
now it is 1.3G
swap 1.3G

Note:  if you reboot it again, it will be 1.2 Gb(default) only. because it is temporary. to make it permanent we need to write a script

- when you create a file to increase file capacity it is only temporary but not permanent.
 in order to make it permanent, we need to create a run control script for the default run level.

to permanent the swap file:
# cd /etc/rc2.d
# vi S100 swapfile
  mkfile   100m   /usr/swapfile
  swap   -a   /usr/swapfile                               (:wq! = save & exit)

# pwd
/etc/rc2.d
# ls
S100                                    // every time when you execture S100 file execute

To delete the swap file:
swap -d /usr/swapfile
# rm  /usr/swapfile
# df -h   (now it will be swap 1.2G)
# swap -l
only one file s1

No comments:

Post a Comment