-   Linux - Software (
-   -   Max swap partition size (

mindcry 11-17-2003 11:56 AM

Max swap partition size
I was wondering if anyone had an answer of what the maximum allowed swap partition was. Someone mentioned to me that the max swap partition size that is allowed is ony 2GB.

zaphodiv 11-17-2003 01:02 PM

Sounds about right, I'd guess 2GB of ram +2Gb of swap fills the whole address space in a 32bit machine.

Old kernels only used swap partitions up to 128MB but you could have more than one. A quick search didn't find any definative documentation on what the maximum is or which kernel versions can use large swap files.
The swapfile mini-HOWTO seems to be out of date.

Unless you are trying to do somthing unusuall like a memory intensive calculation you probably don't need 2GB of swap. The old "twice the amount of ram" rule is a anacronism from back when people used xwindow on 16MB machines.
The only time I noticed all my swap being used was when netscape leaked all the available memory, with a lot of swap the machine used to take minutes of harddrive thrashing to recover after netscape finally segfaulted.
Harddrives are much faster these days but I would not expect a machine making use of 2GB of swap to be very responsive.

Tinkster 11-17-2003 01:10 PM

That's correct for the 2.4 kernel ... there
was an ongoing discussion to change that
for newer kernels on the developers list,


mindcry 11-17-2003 02:03 PM

So what would you suggest for a server with 8gb of ram? 2GB isnt close to the general 2x the amount of RAM rule.

tmillard 11-17-2003 02:20 PM

2 Gigs! My box has 8 Megs of Ram and a 32 MB Swap partition.
I guess some people just want to fell like they have a *LOT* of memory.

tmillard 11-17-2003 02:22 PM

Correction, _One_ of my boxs!

Tinkster 11-17-2003 02:35 PM

You could look at
/usr/src/<your kernel mumble>/include/linux/swap.h
and see whether you can locate the bit that does
the limitation.... fix and recompile :}

As for the 2x rule ... I don't know how closely one
has to stick to it these days, but then I've never
run a server that well equipped (or heavily used)

I'd suggest having a try with 2GB and see what
kind of usage is made of it in the first place... leave
a spare 14GB behind your swapper so you can
resize it if you decided to patch the kernel.


mindcry 11-17-2003 02:53 PM

yeah it seems that the server has completly used all of the swap except for about maybe 50MB to 100MB. Also, it seems to have used most of the ram as well. It is pretty much pushed to the bone.

All times are GMT -5. The time now is 11:06 PM.