Re: [SLUG] swap drive, partition or no?

From: Ian C. Blenke (icblenke@nks.net)
Date: Fri Apr 05 2002 - 11:29:09 EST


On Thu, 2002-04-04 at 18:07, Paul Braman wrote:
>
> I've got this 4G HD sitting around and I figured I would use it as a "swap
> drive" for an installation I'm doing. (Debian, maybe, if I can be
> convinced I'm still geeky enough.)
>
> My question is, would the Linux kernel get more use out of the drive if I
> partitioned it up into, say, 4 1G partitions or just left it as one, big
> swap space?
>
> Or...does it matter?

To answer your specific question, it is best NOT to put multiple swap
partitions on the same drive. The more spindles the better. Linux will
parallelize swap read/writes across available swap partitions. If you do
this with more than one partition on the same drive, your drive head
will fly back and forth between the two partitions severely hampering
performance.

Ideally, you want to have a swap partition on a spindle to itself, or on
a spindle with a filesystem that is rarely accessed. If you have a
single drive system, it is best to have one large partition for swap up
to the number you need.

This is only part of another reason it isn't wise to use swap files
instead of partitions.

At home, I have two 80G drives, each with a 1G swap slice. This gives me
2G of swap that is written between the two drives when needed. With 1G
of RAM, however, SWAP is RARELY needed, and only when I'm building large
things while running WindowsXP under VMWare.

The "2x Physical Memory" thing is a function of the VM in use and the
amount of RAM you have. With Solaris, the rule of thumb is 2x, and that
seems to have followed through to the Linux world. Honestly, I can't
remember if it's Andrea or Rik's VM that suggests the 2x physical RAM
rule, but from long experience with Linux in general, and in my personal
opinion, the more RAM you have the less swap you really need.

- Ian C. Blenke <icblenke@nks.net> <ian@blenke.com>
http://ian.blenke.com



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:49:01 EDT