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.


If you enjoyed the article, please share it

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

comments powered by Disqus



My name is Guillermo Garron. I am telecommunications engineer from Bolivia

I like technology a lot, and this site is mainly dedicated to that

Social feeds

rss | twitter | email | google+

Posts via email

If you use the letter icon above and subscribe to my tinyletter newsletter, you will get one to two emails, related to this site, or not. If what you want is to get the posts of this site via email, use the form below

Enter your email address:

Delivered by FeedBurner