2

2 Months ago, I installed Ubuntu 12.04 in my PC. I never knew what was swap memory and I gave 1.5 GB for Swap Partition but I read in an Article for a PC with 2GB ram and 100GB+ Hard disk, We should allocate 2GB for swap. Now I realize why PC crashes often. How can i increase my swap memory now?

5
  • Welcome FrEE-D: Have you read the Swap FAQs. help.ubuntu.com/community/SwapFaq. This may be a good starting point Jul 26, 2012 at 11:31
  • Use GParted but you need to swapoff the swap partition, you can then modify its size. You can only increase if it there is an unallocated space next to it. After increasing the partition size, you can swapon it again. Here are useful tutorial that will help you: gparted partitioning and modify partitions with gparted
    – Peachy
    Jul 27, 2012 at 1:52
  • If you have too little swap, then you would likely see out of memory errors, or see processes killed by the kernel to free up memory. The crashes you see might be due to something else. Do you see any errors printed to the screen or saved in /var/log/kern.log that correspond to these crashes? Jul 27, 2012 at 3:42
  • @Mitch Since none of the answers to that question, as written, will solve this (not even yours, as there usually won't be unpartitioned space existing already into which to expand the swap partition), I don't think we should consider this a duplicate. Furthermore, when increasing swap, it's easiest to just add a swap file (or, sometimes, a second swap partition), which wouldn't be appropriate there. I think these really are separate questions. Aug 1, 2012 at 21:44
  • @EliahKagan Thanks for the comment. Note taken:)
    – Mitch
    Aug 2, 2012 at 1:50

1 Answer 1

0

Does it really crash because of swap space? Did you see the memory usage go up and see it crash? I mean, it could crash for a lot of reasons.

You can either increase the swap partition size with a tool like gparted, probably only from a live cd though. Or you can create a swap file.

1
  • Note that you can have multiple swap partitions/files so you don't have to increase the existing partition, but I'd also be surprised if a system with 2Gb was crashing due to swap. I have 2 systems with 2Gb and neither uses much swap space, but if you had a memory hungry application, it might need swap space and become very sluggish with lots of disk activity before hanging (becoming unresponsive); is this what you are calling a crash? Of course, the alternative is you have a disk error in the swap area and this is causing the crash, in which case more swap won't help.
    – StarNamer
    Jul 26, 2012 at 12:03

Not the answer you're looking for? Browse other questions tagged .