1. P R E S E N T E D B Y :
A S H U T O S H G U P T A
S O K I N A S O R O K H A I B A M
C H I T A R A N J A N H
SWAP
ADMINISTRATION
2. OBJECTIVE:-
How to create and manage Linux swap space, file
based swap, partition based swap??
To create swap space if physical memory is full.
If needed increase the amount of swap space.
To create swap space even if there is not available
partition, but space is available in already existing
partitions.
3. SWAP SPACE
Linux divides its physical RAM (random access
memory) into chucks of memory called pages.
Swapping is the process whereby a page of memory
is copied to the preconfigured space on the hard disk,
called swap space, to free up that page of memory.
The combined sizes of the physical memory and the
swap space is the amount of virtual memory
available.
4. SWAPPING:-
Swapping is the process whereby a page of memory
is copied to the preconfigured space on the hard disk,
called swap space, to free up that page of memory.
If a process needs to bring a virtual page into
physical memory and there are no free physical
pages available, the operating system must make
room for this page by discarding another page from
physical memory.
5. SWAP TYPES:-
Swap space can be
a dedicated swap partition (recommended)
a swap file
a combination of swap partitions and swap files.
6. NEED OF SWAP SPACE
Swap space in Linux is used when the amount of
physical memory (RAM) is full.
If the system needs more memory resources and the
RAM is full, inactive pages in memory are moved to
the swap space.
While swap space can help machines with a small
amount of RAM, it should not be considered a
replacement for more RAM. Swap space is located on
hard drives, which have a slower access time than
physical memory.
7. WHY SWAPPING:
Shortage of memory
Efficient memory management needed
Process may be too big for physical memory
More active processes than physical memory can hold
Requirements of
multiprogramming
Efficient protection scheme
Simple way of sharing
9. CONFIGURING SWAP SPACE USING
DRIVE PARTITION
STEPS:-
First check the current swap usage by using the
commands “swapon –s” or “free”.
Create a new partition using fdisk. Set the partition’s
system id as “82” (Linux Swap / Solaris).
Prepare the swap partition:- “mkswap <partition name>”
Enable the swap space for use by the system:-
Temporary enable: “swapon <partition name>”
Permanently enable: “gedit /etc/fstab”
To display current swap space:- “swapon –s”
To disable swaping on a partition, use “swapoff
<partition name>” command.
13. CONFIGURING SWAP SPACE USING SWAP
FILE (if there is no available partition )
Create a file and write bytes to it equalizing the amount
of swap space you wish to add,using dd command:-
“dd if=/dev/zero of=/ram1 bs=1024 count=200000”
Prepare swap partition:- “mkswap <swapfile name>”
Enable swap space for use by the system:-
Temporary enable: “swapon <swapfile name>”
Permanently enable: “gedit /etc/fstab”
To display current swap space:- “swapon -s”
To disable swaping on a partition, use “swapoff
<swapfile name>” command
16. Conclusion
Managing swap space is an essential aspect of system
administration.
Swap management is useful if you are planning to
increase RAM in near future.
It is also useful in increasing processing speed of the
system