Categories

Increase Swap Memory in Linux

Written by Guillermo Garron .
Date: 2011-08-26 19:22:00 -0400

This is usually not needed, but if for some reason you need to increase the Swap memory of your system, I’ll show you now, how to do it.

You can read more about virtual memory if you want.

Now let’s see how to increase, or create a swap file, to be used for Linux as virtual memory.

First we need to create a file.

sudo dd if=/dev/zero of=/mnt/file.swap bs=1M count=512

We are instructing Linux to create a file of 512 blocks of 1Meg each. You may need to change that value according to your needs.

sudo mkswap /mnt/file.swap

This will format the file as swap.

sudo swapon /mnt/file.swap

And this will add the file to system, so it can be used.

That is only temporal for this session, if you want this to permanent, add the following line to the /etc/fstap file:

/mnt/file.swap none swap sw 0 0

Now you have more virtual memory.

permalink

If you enjoyed the article, please share it

twitter | facebook | google+ | linkedin | email | reddit