SWAP on Linux 04-18-2011, 03:11 PM
#1
Assalamualaikum war,wab,
Ok let me to share about swap partition in linux, hmmm,, that's look nice, because in linux divides the RAM (Random access memory) into chucks of memory called pages.
what about SWAP ?
Swap or swapping is the proccess where by a page of memory is copied to preconfigured space on a hard disk.
2 reason why must choose/use SWap.
- when the system requires more memory and physically available, the swap kernel out less used pages and gives memory to the current application running that needs the memory immediately,
- the significan number of the pages used by an application during it's startup phase may only be used for initialization and then ever uses again
in the linux hs two forms of swap space
- swap partition
- swap file
the swap file is a special file in the FS that resides amongst your system and data files/
the swap partition is independent section of harddisk, and no other files can reside her

lets try to check swap space we have, use command
enet@liyan-junia:~$ swapon -s
Filename Type Size Used Priority
/dev/ramzswap0 partition 477472 96716 100
/dev/sda7 partition 1425772 0 -1
enet@liyan-junia:~$
OK, its my swap partition data,
howver, i need to add extra swap partition in my system, hmm.. what must id ?
ok lets prepare it, firs log in as root
$ sudo su -
[password] ;
#
lets check the marked partition for swap
# fdisk -l /dev/hda
next replace /dev/hda with the device of the harddisk in your system eith swap partiotion on it.
you can see like it,
Device Boot Start End Blocks Id System
/dev/hda1 3266 3286 859466 81 Linux swap / slackware
enet@liyan-junia:~$
ok once the partititon marked as swap we will prepare it first,
# mkswap /dev/hda1
swap ready to use, and to active it immediately use command swapon again
# swapon /dev/hda1
and the next we will try to make swap file, linux also supports the swap file in the system, for use swap file, its easy like swap partition
ok lets make swap file, use commadn ;
# dd if=/dev/zero of=/[Name of swap file] bs=2048 count=2097152
don't forget to change size of the swap file;
count : 2097152 > GB in kylobytes
bs : 2048 > change to size u need
Ok the empty file of swap file has created. next we must prepare the swap file;
# mkswap /Name file
succce.. and the /etc/fstab entry for a swap file look like this
/Name file none swap sw 1 1
enet@liyan-junia:~$
ok thats all about make swap in Linux system...
remember to manage swap space is an essential aspect of syamin, so don't afraid to do this,, let's develop your mind with linux and make your new experiment of Linux, linux never dies,, and get the codes feel the soul
wassalam
source : http://0nto.me/


![[Image: t3r4.jpg]](http://0nto.me/wp-content/uploads/2011/04/t3r4.jpg)
![[+]](https://sinister.li/images/modern/collapse_collapsed.png)