Friday, May 15, 2009

How to assign swap area in Linux to increase speed?

We can assign swap area in linux either on a partition or a file.

I am creating here swap area using a file.

First we need to create the swap file.

dd if=/dev/zero of=/swapfile bs=1024 count=2000000

this will create a file 'swapfile' under / of size above 2gb

Type the following commands :-

mkswap /swapfile

swapon /swapfile

Now we can add the swap entry on fstab so that on every reboot, system will automatically loads the awap area.

vi /etc/fstab

append the following line to the bottom

/swapfile  swap  swap  defaults  0 0

save and quit

To see the swap usage use the command top 

thanks & regards

tell2humanlinux@gmail.com

No comments:

Post a Comment