-   Linux - Newbie (
-   -   how much swap space is needed; how to increase swap space? (

johnpaulodonnell 03-22-2007 05:34 AM

how much swap space is needed; how to increase swap space?

As a rule of thumb, how much swap space should you have? I read different values in different places...

I'm running a fairly large code at the minute and I'm getting a segmetation fault...I know where the crash is happening and it has been suggested that it might be because I have insufficient swap space...but I don't see how that can be.

I have 3Gb of RAM and 1Gb of swap space...I monitor the memory usuage using top and it never really exceeds about 40% of total...

although maybe I'm missing something and I do need more swap space? Would be nice if this sorted the seg fault...wishful thinking!


syg00 03-22-2007 05:50 AM

Don't think it'll help in this case (40% :eek: ), but it's as simple as creating new partition(s)/file(s) and mkswap/swapon.
I keep a couple of spares around just in case. Add them as I need them (obviously, mkswap only needs to be run once each).

bdox 03-22-2007 06:10 AM

if you never exceeds about 40% of total swap, so for you 1Gb should be ok. typically the guides said your swap should be twice as big as your RAM, but that was back when normal amount of RAM was in the 2Mb - 256M interval...
I would suggest you:
1.reformat you swap partition.
2.create and other (1Gb) swap partition (better in other hdd, closer to the beginning of the disk)
3.add the new swap partition to /etc/fstab

that should put you in the safe side. =)

for doing that you can use gparted or a similar (many distros has similar tools included).
Good Luck!

johnpaulodonnell 03-22-2007 07:15 AM

thanks for that.

I went for a swapfile - seemed easier!

lurko 03-22-2007 08:22 AM

if you run "free" it will tell you how much of your swap is being used. Obviously it should show no swap space available if you need more of it. Probably you've got most of that gig available.

Emmanuel_uk 03-23-2007 03:20 AM

google for swappiness linux as well
and see if increasing it helps
Could be interesting
decrease it for faster performance

All times are GMT -5. The time now is 09:10 PM.