on Wed, Nov 28, 2001 at 05:02:38PM +0000, John Seago wrote:
When Chris opened up my case and replaced the cables he found that my rather elderly computer was in fact suffering from old age and neeeded replacing. I am having a `bare bones' computer built to take my new drives, and this raises a question, up to now I have followed advice I read somewhere that the swap space be twice the memory, (RAM?), having 64 whatever-they-ares of memory I have a 128 swap space, having ordered 128 memory, do I need a 256 swap space? All suggestions gratefully recieved, although I may be too old/full of pain killers to understand any explanation.
I think the "twice times physical memory" (yes, RAM :) rule is very general. Certainly with an 8 meg machine, it can pay to give it about 64 megs of swap. The rule is a good safe default, although not necessarily the most efficient.
The real issue when deciding how much swap space you want, is the purpose to which you intend to put the box. I currently run a server which acts as a desktop for several users at the same time, as well as handling mail routing and various other things. The box only has 64megs of ram, and rarely uses more than 10 megs of swap space. Running things such as games and so on can greatly impact the swap usage.
You can find out how much swap space is currently being used by typing "free". You will most likely see a line such as this:
total used free [snip] Swap: 152608 6120 146488
This might help you to determine how much swap space you actually use. Having too little swap space is tends to be annoying, and leads to performance problems, as well as programs running out of memory when you don't want them to. There are very few side effects of having a little too much swap. But having a ridiculously large amount of swap space just seems like a waste of good disk space to me. :)
Also under some operating systems the structures in the kernel that keep track of swap space are "locked" into physical ram, that is, they cannot be swapped out. So having too much swap space can make these structures unnecessarily large. I don't know if this issue affects Linux, though.
If at all possible, try to play around with the amount of swap space you have. Maybe try three sizes; small (say, 32 or 64 megs), medium (say, 128 megs) or large (say, 256 megs).
You could always turn any free space from playing about with the swap size into another partition. This could be used as a /tmp filesystem, or even something like /usr/local depending on the size of your swap partition after experimentation.
Or, just think "disk space is cheap, would I really miss 256 megs of hard disk space?"
Good luck!