How to add Swap Space on Ubuntu

12:00 PM

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.

Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then an additional 1x physical RAM for any amount above 2 GB, but never less than 32 MB. That's formula which usually used but in practice you do not need to allocated a Swap Space when you have RAM more than 5 GB unless you run a bloody busy server, don't waste your HDD space dude :D

recently, i have experience this :
recently, i have install Ubuntu 11.04 on my desktop-pc, i have lack space HDD than i decide not to make a swap space however i have 768 Mb of RAM installed on my PC. and what happen then ??
when i was browsing (in a long time), both firefox or chromium stop working periodically and i guest this swap space effect. Then i thought to make the swap space in the rest of hdd space that I have and I GOT IT!!, this solve my problem.

Follow this guide How to Make a swap space when Ubuntu (the OS) has been Installed on your PC.
  • Install GParted partition editor, GParted is such ubuntu partition tools which can use to make/allocate  free space in your HDD for use as Swap Space.

  • Format free space which has been allocated to linux-swap file system.




Gparted format to Linux-swap
  • Open your Terminal, type following command to activate your swap space swapon /dev/sda4, change /dev/sda4 to your partition.

  • you can check memory usage by type command free -m in terminal.

yes, that all. simply step above have save my ass :)

0 comments:

Post a Comment