Re: Newbie Question About Swap Partition
Google Mike (googlemike@hotpop.com) writes:
> I have standard RH9 Linux with standard ext3 filesystem.
>
> I have 512 MB of RAM and plan to go to 1GB of RAM tomorrow with a new
> RAM chip. My swap partition is set to approximately double the RAM
> size.
>
You should have been watching how your swap gets used. If it barely gets
used, then it won't need increasing with more ram. If is getting used
significantly, the fact that you are doubling your RAM should help
the situation.
Swap is used to make good use of RAM. It keeps things that aren't being
used at the moment handy, so you don't have to manually keep reloading things.
If you've got a little bit of RAM, the swap partition will get a lot of use,
because the operating system and the applications need more RAM space than
you have. So the unused bits get swapped out when not being used, and
swapped in when needed. If you've got enough RAM, as much as possible will
be kept in RAM, since it's faster than using the hard disk. Hence, swap
space will be less used as you increase your ram. Unless, of course, you
are doing things that use up the available RAM pretty fast.
Note that it is useage that really specifies the size of the swap partition,
not some absolute value. I gather much of the "swap should be two times
the RAM" dates from memory was relatively limited, so you would find
that swap was needed often. But that was some time ago.
I first installed Linux four years ago, in a very limited system, so limited
that I didn't go very far with it. I went and bought a used Pentium with
32megs of RAM, and decided to make swap equal to three times the RAM. I
did that because I anticipated getting more ram, and I had the hard disk
space to spare. I went to 64megs, and then 96megs, and using free I
rarely saw much use of the swap partition. Admittedly I am underusing
the system, but it points out that swap plus RAM needs to be large only
depending on what you are doing with the system.
When I moved to this computer in January, I just made swap equal to RAM,
because I know I don't use enough for swap to be used that much. If I'd
had limited hard drive space, I might have considered less swap. Not only
is much of my RAM free, but swap barely gets used.
This might change if what I used the computer for changed. But it's fine
right now, and unless you see excessive use of swap, then you shouldn't
have to worry about increasing swap.
Note that you can use swap files rather than partitions. Since I don't
need them, I've not paid full attention to how to do it, but it is a solution
if one comes upon something that suddenly requires more swap. If it's a
temporary matter, then there's no sense fiddling with the swap partition.
Michael
> 1. Do I need to type some command after adding RAM to manually
> increase the size of the swap partition? >
> 2. Will the swap partition automatically increase and I won't need to
> type a command manually?
>
> 3. Can I increase it without risk to whatever else is on the disk, if
> I have available space?
>
> 4. What size should it be? Should it be RAM x2 + 64MB, or is there a
> more preferrable setting?
>
> Thank you. |