Ubuntu Swap

Share it!!Share on Facebook0Share on Google+0Tweet about this on Twitter0Share on Reddit0Share on StumbleUpon0

Hello guys,

In this post will talk about Swap, how to improve your machine performance using swap, and how to manage it.

========================================================

1. What’s Swap?

it’s a part used on your hard drive to be  as virtual memory combined with your random access memory (RAM), and it’s a customizable space can be changed any time “will get to this point in no.4″

2. What’s the idea of using Swap?

Using swap improve your distribution performance and you will notice that if you didn’t used swap before. running time of big application which has many dependencies such as Gimp, Open office, …..

also it will help with processing application specially video editing applications.

I didn’t use swap in my laptop when I installed ubuntu 9.10 and this really make big difference specially with running openoffice and video editing applications. Otherwise my desktop with same distribution “ubuntu 9.10″

with swap and nearly same hardware specifications it was working great with all these applications.

3. How to manage Swap before the installation?

This is the easy part. In preparing partition window  add new partition and set it as swap volume.

For example : you have 2 GB of RAM installed, you have to make swap size equal your installed RAM at least, and make it bigger it’s up to you. ” You can make the swap lower than installed RAM if you have low hard disk space it’s okay”

4. How to manage Swap after the installation?

  • Creating a file the size you want.
  • Formatting that file to create a swapping device.
  • Adding the swap to the running system.
  • Making the change permanent.

For Adding a 512 MB swap

  • Creating a file for 512 MB size you want:

We will create a /mnt/512Mb.swap swap file.

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

Here count=512, means we want our file to contain 512 blocks of bs=1M, which means block size = 1 MegaBytes. Be careful *not * to do this dd of=/mnt/512Mb.swap bs=1M seek=512 count=0 Though the file grows to 512Mb immediately, it will have holes that makes it unusable.

  • Formatting that file to create a swapping device:
sudo mkswap /mnt/512Mb.swap
  • Adding the swap to the running system:
sudo swapon /mnt/512Mb.swap

The additional swap is now available and can be seen by “cat /proc/meminfo

  • Making the change permanent:

Edit the /etc/fstab:

gksudo gedit /etc/fstab

Add this line at the end of the file:

/mnt/512Mb.swap  none  swap  sw  0 0

Save and reboot.

Resource helped in this post   1

That’s it for now.

Share it!!Share on Facebook0Share on Google+0Tweet about this on Twitter0Share on Reddit0Share on StumbleUpon0
No Comments

Add a Comment

Your email address will not be published. Required fields are marked *