0

Using Ubuntu 12.04 LTS, upgraded from 11.10. Had no idea while installing Ubuntu for the first time. So missed SWAP partition. Now, at times Ubuntu hangs and system monitor shows the memory usage full. Is there any method that I can create a partition from the current Ubuntu partition and assign it as SWAP partition ? If yes, kindly guide me to do the same.

How much SWAP partition space is recommended ? Current specs - 6 GB RAM, 1 GB Radeon GPU.

user227495
  • 4,089
  • 17
  • 56
  • 101
  • In case you don't hibernate you may also add a swap on file: http://askubuntu.com/questions/126018/adding-a-new-swap-file-how-to-edit-fstab-to-enable-swap-after-reboot – Takkat Feb 04 '14 at 13:21
  • Tip: Use top or I would suggest using htop to observe what type of application/service cause RAM overload. – AzkerM Feb 04 '14 at 13:29

3 Answers3

0
  • To resize your Ubuntu partition and create a new swap partition from that space,follow the below steps,

    1. Boot Ubuntu live disk and then open Gparted.

    2. Right-click on the Ubuntu partition and select Resize option to create a new unallocated space of the desired size.

    3. From that unallocated space,create a new SWAP partition.

    4. Now right-click on the swap partition and select and select swap-on.

    5. Add an entry for your swap partition in /etc/fstab file to make swap-on the partition on startup.

    6. See this for how much space did you have to allocate for your swap partition.

Avinash Raj
  • 78,556
0

First of all, thumbs up for this question. This is indeed a good one though there are similar questions which has been already asked such as "I have 16GB RAM. Do I need 32GB swap?". This will help you to decide how much swap that you may need to allocate. Even, it is said that a good rule of thumb on deciding a swap allocation is to double the actual RAM size. Having said that it doesn't mean you will need 12GB of swap allocation since you have a 6GB physical RAM. Swap may vary on what actual purpose that a user or their system has to deal with.

But by the look of your question, I doubt that something cocky going on the background or some sort of application/services hogging your memory (just an assumption). While moving on with the swap, there's an interesting article available on the Official Ubuntu page itself about swap FAQ's on creating, expanding swap... etc.

I would suggest you to refer the part explained in-detail as; "Four-step Process to Add Swap File".

Some Interesting Source: Importance of Swap Partition

AzkerM
  • 10,270
  • 6
  • 32
  • 51
0

you have plenty of ram so dont need too much Swap space,

Load a Live enviroment (from CD or USB) so that your filesystem is free and you can edit its partition.

use gparted and lower your ext partition a couple of Gb

Add a new 'Linux_swap' partition

reboot

open gparted right click on that section of partition and turn it on (alternatively use the disks program click on the swap partition and click the little 'play' button beneath)

you have plenty of RAM so don't need too much swap space, 2Gb is plenty enough, probably overkill. you can increase performance of swap by using a different HDD than your filesystem, using the same technique just on a different HDD, this way you won't have to use a live enviroment either.

P.S. Backup if you don't want to lose anything. playing with partitions can seriously damage data. Defragging first can help stop this also, but no guarantee

Sharkytrs
  • 21
  • 4