• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How big should I make my swap partition for Mandrake10?

A swap partition is not necessary. A good rule of the thumb used to be : swap = 2*(Ram in MB).
I usually have @ 100 MB swap w/512 MB RAM now.
Others may have different, better ratios.

Edit: I have 1.1 GB swap partition. The line should have read "I usually have @ 1000 MB partition..."
 
If space isn't an issue I would just stick to 1 or 2G, if you need more swap space than that you should have gotten more memory a long time ago.
 
sorry forgot to put:

Quote from http://tldp.org/LDP/sag/html/swap-allocation.html[/b

Some people will tell you that you should allocate twice as much swap space as you have physical memory, but this is a bogus rule. Here's how to do it properly:

Estimate your total memory needs. This is the largest amount of memory you'll probably need at a time, that is the sum of the memory requirements of all the programs you want to run at the same time. This can be done by running at the same time all the programs you are likely to ever be running at the same time.

For instance, if you want to run X, you should allocate about 8 MB for it, gcc wants several megabytes (some files need an unusually large amount, up to tens of megabytes, but usually about four should do), and so on. The kernel will use about a megabyte by itself, and the usual shells and other small utilities perhaps a few hundred kilobytes (say a megabyte together). There is no need to try to be exact, rough estimates are fine, but you might want to be on the pessimistic side.

Remember that if there are going to be several people using the system at the same time, they are all going to consume memory. However, if two people run the same program at the same time, the total memory consumption is usually not double, since code pages and shared libraries exist only once.

The free and ps commands are useful for estimating the memory needs.

Add some security to the estimate in step 1. This is because estimates of program sizes will probably be wrong, because you'll probably forget some programs you want to run, and to make certain that you have some extra space just in case. A couple of megabytes should be fine. (It is better to allocate too much than too little swap space, but there's no need to over-do it and allocate the whole disk, since unused swap space is wasted space; see later about adding more swap.) Also, since it is nicer to deal with even numbers, you can round the value up to the next full megabyte.

Based on the computations above, you know how much memory you'll be needing in total. So, in order to allocate swap space, you just need to subtract the size of your physical memory from the total memory needed, and you know how much swap space you need. (On some versions of UNIX, you need to allocate space for an image of the physical memory as well, so the amount computed in step 2 is what you need and you shouldn't do the subtraction.)

If your calculated swap space is very much larger than your physical memory (more than a couple times larger), you should probably invest in more physical memory, otherwise performance will be too low.

It's a good idea to have at least some swap space, even if your calculations indicate that you need none. Linux uses swap space somewhat aggressively, so that as much physical memory as possible can be kept free. Linux will swap out memory pages that have not been used, even if the memory is not yet needed for anything. This avoids waiting for swapping when it is needed: the swapping can be done earlier, when the disk is otherwise idle.

Swap space can be divided among several disks. This can sometimes improve performance, depending on the relative speeds of the disks and the access patterns of the disks. You might want to experiment with a few schemes, but be aware that doing the experiments properly is quite difficult. You should not believe claims that any one scheme is superior to any other, since it won't always be true.
 
I have a gig of RAM, so I just set it to 2 gigs or what?

Nice article pitupepito2000, but I have no idea what programs I'll be using, let alone how much memory they are gonna take 😕

Don't you think the 2*RAM in MB formula is kinda counter-intuitive since the more RAM you have, the less swap space you should need?
 
I use 512 megs, by the time that starts to fill up then something is seriously wrong and your machine will be slow as a dog.

I have a gig of RAM....

The swap = 2xRAM rule was created when high end computers ran 32 megs, and only the most hardcore people ran 64megs. You don't even need a swap file anymore for you computer to function correctly.. with early 2.4 and 2.2 kernels this was true, but not anymore. The situation has changed quite a bit since then. (but a swap partition is still usefull, so make one)
 
1.5-2x is safe. Until you start getting into the multi-gigabyte range. On the Sun system iused to admin, we had, I think, 48GB of ram. We had maybe 2GB swap. 😉
 
Originally posted by: drag
I use 512 megs, by the time that starts to fill up then something is seriously wrong and your machine will be slow as a dog.

I have a gig of RAM....

The swap = 2xRAM rule was created when high end computers ran 32 megs, and only the most hardcore people ran 64megs. You don't even need a swap file anymore for you computer to function correctly.. with early 2.4 and 2.2 kernels this was true, but not anymore. The situation has changed quite a bit since then. (but a swap partition is still usefull, so make one)

I disagree. I think it is still necessary. If you turn down the swappiness, it might become less necessary though. I can see a .5-1:1 swap to memory ratio if you have enough these days though. Just my opinions. 🙂
 
Well it isn't, strictly speaking, nessicary.

The memory management in the kernel can function perfectly well without the swap.. it's designed to. There are lots of applications that you can see Linux running in were having a swap partition is impractical, like Knoppix for instance, rescue disks, or embedded file systems on flash drives. 2.2 kernel's memory management would break without it.

But you definately want a swap partition, everything works better with it.
 
Back
Top