[TriLUG] SWAP size vs physical RAM size

David Brain dbrain at gmail.com
Tue Aug 7 14:20:55 EDT 2007


Hi,
Hi,

I think from the sound of your current utilization you'll be fine
leaving the swap partition as is.  Obviously watch the usage as you
grow the load on the box, but you should be fine.  I think the whole
2x Physical mem thing is somewhat anachronistic now, back in the day
when a machine had 64Mb of ram adding an additional 128MB of swap
meant it had enough space to work, compile things etc.  With 4GB being
somewhat typical these days I've been tending towards allocating 1x
RAM on some servers, more for 'emergency use' than anything else.  If
you consider the IO time needed to move 8GB off/on a disk the
performance time of a machine using all your 2xRAM swap is going to be
marginal at best.

On 8/7/07, Alan Porter <porter at trilug.org> wrote:
>
>  > how crucial is it to have a swap file a lot larger
>  > than the physical ram space?
>
> Not at all crucial. I would make sure that your swap partition is just a
> wee bit larger than your physical RAM so that you can do magic things
> like 'suspend to disk', hibernate, etc.

Well, this sounds like a server, so with any luck that shouldn't be an issue.

>
> If you find yourself needing some swap space (unlikely), then just make
> a swap file... or two.
>
> dd if=/dev/zero of=/.swap count=1 bs=1 seek=1G
> mkswap /.swap
> echo "/.swap none swap sw 0 0" >> /etc/fstab
> swapon -a
>

Be aware that swap _files_ are somewhat less performant than swap
partitions as there is the additional file system overhead.

David.



More information about the TriLUG mailing list