Tuesday, January 6, 2009

Increasing the swap space

How can you increase your swap space

For some application sometimes you will need more swap space than that what you have now. In my case I was having only 840 MB and when I tried to install Oracle 10g server i couldn't install it as it requires more swap space. So I had to increase my swap space. First you have to see how much swap space you are having now. For that go to terminal and type swapon -s which will show you the swap space and it will show you something like this

asha@asha:~$ swapon -s
Filename Type Size Used Priority
/dev/sda4 partition 979956 313344 -1

Now you can take some space from one of your partitions. And if you are having another partition other than / then better to take from that. And one warning is there.If you have some important data you better back up.

In order to create supplementary swap file you are using dd (data dump) command.You have to do it in the root.

So type in the terminal

dd if=/dev/zero of=/extra-swap bs=1M count=1024

We'll use the mkswap command to make our file swap-consumable for the Linux kernel.

mkswap /extra-swap

To turn on the swap file run

swapon /extra-swap

Now swapon -s will show the new file also.

And to make this swap on even after booting your machine you have to

cp /etc/fstab /etc/fstab.mybackup

Now its done. And you can continue with the installation.

No comments:

Post a Comment