Tuesday, February 9, 2010

Increase "swap" space in Linux

How to increase "swap" memory in Linux.

1) Create a new hard drive partition. I will use "/dev/sda" for this practical.

To verify your hard drive identity, use "fdisk -l"

2) Follow these steps.

- fdisk /dev/sda
Press "n" for new partition.
You'll get First Cylinder Name :- Press Enter
You'll get Last Cylinder Name :- type "+500M" (Adding 500MB as a swap space)

- Press "t" to assign "swap" id for a newly created partition. Here,redhat uses "82" as a swap id.
- Press "w" to write changes to disk & exit.

3) Use "partprobe" command

4) mkfs.ext3 /dev/sda6 Making File System on a newly created partition,i.e. /dev/sda6

5) mkswap /dev/sda6 Make this partition as a "swap"

6) swapon /dev/sda6 Enable "swap" partition.

7) Use "top" command to check the total memory size.

8) Make permanent entry of "swap" space during reboot, Write a new line in "/etc/fstab"
/dev/sda6 swap swap defaults 0 0

save & exit (:wq)

9) Reboot Linux & Check.

That's it

No comments:

Post a Comment