No subject


Tue Nov 29 10:43:08 WST 2011


file size of 2 x RAM Qty




-----Original Message-----
From: Matt Kemner [mailto:zombie at wasp.net.au]
Sent: Thursday, 4 October 2001 2:26 PM
To: plug at plug.linux.org.au
Subject: swap files (Re: [plug] New linux install)


Hi Richard

On Thu, 4 Oct 2001, Richard Bartlett wrote:

> Can I increase the systems performance by
> increasing the swap file size?

No, you can't.. The only thing a larger swapfile will prevent, is you
filling up your RAM and swap completely, which will either lead to a
complete deadlock, or several processes dying due to lack of memory.

Once a system starts to swap, you will lose performance.  The more you
swap, the more performance is lost while the system is copying data from
RAM to Disk and back.  In fact, having a larger swap space would in theory
eventually lead to slower performance before the system crashes
completely, because you will be more in swap before OOM (Out Of Memory)
occurs.  The only way to increase performance would be to either buy more
RAM, or a faster HDD.

> And if so can I do it now that I have linux running or do I need to do
> a reinstall.

If you want to increase your swap space without repartitioning, you can do
that by swapping to a file as well as to a partition.  However, this is
slower for a number of reasons, so repartitioning is the best way - but
you do need to reinstall Linux if you repartition.

To swap from a swapfile:

dd if=/dev/zero of=/spare/swapfile.swp bs=1024 count=10240
mkswap /spare/swapfile.swp
swapon -p -2 /spare/swapfile.swp

replace /spare/swapfile.swp with the full path to your swapfile, and
replace "count=10240" with the size (in kilobytes - 10MB in this case) you
want the swap file to be.

the -p -2 option on swapon tells it to assign it with a priority of -2,
which is lower than the default priority of -1, which means your existing
(faster) swap partition will be filled up first.

 - Matt





More information about the plug mailing list