Max swap size?

Andrew Jorgensen andrew at
Wed May 28 23:49:42 MDT 2008

On Wed, May 28, 2008 at 8:36 PM, Stephen Ward <sjward at> wrote:
> Today I was poking around on a CentOS amd64 machine that keeps
> randomly crashing.  I am not the sysadmin for this machine; he is on
> vacation.  Anyway, I noticed something that seemed unusual to me.
> This machine has 1 GB of RAM, and a grand total of 8 GB of swap
> consisting of two 4 GB partitions, each on a separate drive.  These
> two drives also happen to be in a RAID-1 mdadm device.
> Does a 4 GB swap partition seem excessively large to anyone?  I read
> the mkswap man page and found the following regarding swap
> limitations:

2GB would have been following the old RAMx2 rule that no longer really
applies.  There are rules about how much you want to have if you might
be hibernating though so that could help explain it.  Or maybe that
was the 2x rule.

I assume you meant that the swap partitions are on the same disks as
mdadm devices but not themselves in a RAID configuration.  Recent
kernels will stripe multiple swap devices internally so there's no
reason to put swap on RAID.

You can certainly have a very large swap size if you want but you
ought to question the usefulness of this since you'd be hurting pretty
bad if you were swapping that much.  One can imagine reasons for large
swap though, like maybe a VM that almost never gets touched but stays
in RAM in case it might get used.  Or very liberal use of tmpfs.

Actually now that I mention tmpfs you might want to look into how it's
used on your system.  That could explain having that much swap.

More information about the PLUG mailing list