SWAP Partition
OR
How We Can Create SWAP Space in Linux from any Disk?
• A swap space is an area of a disk under the control of the Linux kernel memory management
subsystem. The kernel uses swap space to supplement the system RAM by holding inactive pages of
memory.
• The combined system RAM plus swap space is called virtual memory.
• When the memory usage on a system exceeds a defined limit, the kernel searches through RAM
looking for idle memory pages assigned to processes. The kernel writes the idle pages to the swap area
and reassigns the RAM pages to other processes. If a program requires access to a page on disk, the
kernel locates another idle page of memory, writes it to disk, then recalls the needed page from the
swap area.
• Because swap areas reside on disk, swap is slow when compared with RAM
• 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.
• Swapping is necessary for two important reasons. First, when the system requires more memory than is
physically available, the kernel swaps out less used pages and gives memory to the current application
(process) that needs the memory immediately. Second, a significant number of the pages used by an
application during its startup phase may only be used for initialization and then never used again. The
system can swap out those pages and free the memory for other applications or even for the disk cache.
Types of SWAP Creation Method?
1- During the OS installation
2- After the OS installation
== > Partition Concept from any disk using fdisk or parted command
== > File method using dd command from any existing storage mount point
=====================================================================================