Swap Management: SWAP which is also called as virtual memory (or) PAGE file
- which is created by taking some memory from hard disk
- the SWAP comes into existence when the physical memory is fully busy. that is it acts as a physical memory for a instance of a time, when physical memory is fully busy.
- the SWAP capacity by default 1.5 times of a RAM. but we can increase it to double the size of a RAM.
- if we increase more than double it will not take, it will work only double.
We can increase the SWAP memory by two methods
1. File
2. Creating a dedicated SWAP partition (File System)
to see the physical memory:
# prtconf |grep "Mem"
#df -F ufs
#df -h
swap 1.2G (now)
now i want to increase swap 1.2G to 1.3G:
two methods
1. file method
2. file system method
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
2. To increase the SWAP capacity by using File System Method
1. select any partition and allocate some space to the partition i.e. the amount of space that has to allocate to increase the swap.
- S4 selected with '100MB' space
2. Edit the file
# vi /etc/vfstab
/dev/dsk/c0t0d0s1 - - swap - no
/dev/dsk/c0t0d0s4 - - swap 1 yes
:wq!
now still 1.2Gb only we need to update some commands
# swap -l
(only one file S1)
# df -h
(swap 1.2G)
# /sbin/swapadd
# swap -l
(now two files)
# df -h
1.3G
to delete swap:
# swap -d /dev/dsk/c0t0d0s4
# swap -l
# df -h
now vi /etc/vfstab and remove the entry of s4
note: recommended is file method.. because only file created thats it.
- in FS method whole slice S4, we need to allocate memory it is difficult and wastage.
- which is created by taking some memory from hard disk
- the SWAP comes into existence when the physical memory is fully busy. that is it acts as a physical memory for a instance of a time, when physical memory is fully busy.
- the SWAP capacity by default 1.5 times of a RAM. but we can increase it to double the size of a RAM.
- if we increase more than double it will not take, it will work only double.
We can increase the SWAP memory by two methods
1. File
2. Creating a dedicated SWAP partition (File System)
to see the physical memory:
# prtconf |grep "Mem"
#df -F ufs
#df -h
swap 1.2G (now)
now i want to increase swap 1.2G to 1.3G:
two methods
1. file method
2. file system method
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
2. To increase the SWAP capacity by using File System Method
1. select any partition and allocate some space to the partition i.e. the amount of space that has to allocate to increase the swap.
- S4 selected with '100MB' space
2. Edit the file
# vi /etc/vfstab
/dev/dsk/c0t0d0s1 - - swap - no
/dev/dsk/c0t0d0s4 - - swap 1 yes
:wq!
now still 1.2Gb only we need to update some commands
# swap -l
(only one file S1)
# df -h
(swap 1.2G)
# /sbin/swapadd
# swap -l
(now two files)
# df -h
1.3G
to delete swap:
# swap -d /dev/dsk/c0t0d0s4
# swap -l
# df -h
now vi /etc/vfstab and remove the entry of s4
note: recommended is file method.. because only file created thats it.
- in FS method whole slice S4, we need to allocate memory it is difficult and wastage.
No comments:
Post a Comment