[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: partitioning revisited



on Thu, Aug 09, 2001 at 09:00:03AM +0100, Keith O'Connell (keith_oconnell@bigfoot.com) wrote:

> 1: I recently read that logical partitions were better than primary
> because of the size limits on the directories. I didn't quit
> understand this. On this laptop I have 4 primary partitions, with the
> 4th holding 4 logical. Is this unwise? Should I just have one big
> logical partition?

There's no benefit I'm aware of.  Some OSs may prefer only on primary
partition, or suffer other limitations, but most such issues are
historical only.

> 2: In my other machines I have 128 Mb memory, so I have had a 128 Mb
> swap file. In my new machine I have taken advantage of the low price
> and put 512 Mb in it. This set me thinking, and I cannot reconcile the
> following I have been told or read;

I've got three general rules of thumb with swap:

  - Swapping sucks.
  - Running out of memory sucks more.
  - Repartitioning sucks most.

There's also a lot of obsolete data floating around about GNU/Linux in
general.

>         a: "With 512 Mb ram you don't need a swap file"

If you're not swapping, this is true.

>         b: "You must have a swap file 2x ram"

Not true.  But a good rule of thumb.

>         c: "Over 128 Mb ram you must have a swap file of there same
>            size"

We'll bet back to this.

>         d: "A swap file cannot be over 128 Mb"
>         e: "A swap file cannot be over 256 Mb"
>         f: "A swap file cannot be over 512 Mb"

From mkswap(8):

    The maximum useful size of a swap area now depends on the
    architecture.  It is roughly  2GiB on  i386,  PPC,  m68k, ARM, 1GiB
    on sparc, 512MiB on mips, 128GiB on alpha and 3TiB on sparc64.

>         g: "Swap files must be in multiple of 128 Mb"
>         h: "Swap files are an irrelevance on modern machines"

Myths.

> My questions are not from a lack of research, rather I have found out
> too much which is contradictory. I would like some guidance in sorting
> the what from the chaff here

Simple truth on swap:  swapping is a kludge.  The benefit is your
program (or worse:  system) doesn't fall over because it runs out of
(expensive, fast) physical RAM.  The penalty is you sacrifice some disk
space, and a shitload of time, swapping data.  Swapping works reasonably
well on a tuned system because there are programs which aren't called
very often -- they can page out to disk, and stay there until they're
needed, at which point something else is swapped and the first program
gets some CPU cycles.  When this happens, you get the illusion of much
more physical memory than you've got.  When it happens a lot, your disks
grind endlessly and your maching is made of February molassas.

The old 2x RAM rule of thumb is still a pretty good one.  Everyone's got
more memory these days (and it's damned cheap for current
architectures), but programs and systems are getting bigger.  

I actually prefer to give my systems about 2x the maximum possible
memory as swap, even if this means they've got 3-4x memory.  Reason
being that it's far easier to add memory (drop the system, pop the case,
squeeze the sticks in) than it is to repartition (back up, verify, back
up again, verify again, repartition, reformat, restore, verify).  As for
sizing swap, I've got partitions variously of 132 MB, 128 MB, and 486
MB, on various systems.

Other considerations include distribution of swap.  On a SCSI system,
span spindles, if at all possible, preferably with swap on each physical
disk.  IDE offers fewer I/O benefits unless you have multiple
controllers, but spanning may help minimize head movement.  I'd
generally discourage use of swap files unless absolutely necessary.

Realize too the downsides are relatively bearable:  too little swap, and
you can't run really big (or lots of) apps.  Too much (and too little
memory), and you're going to be spending a lot of time exercising it.
Bad disk allocation -- you'll lose a touch of speed.  The world is
unlikely to end as a consequence.

-- 
Karsten M. Self <kmself@ix.netcom.com>          http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?             There is no K5 cabal
  http://gestalt-system.sourceforge.net/               http://www.kuro5hin.org
   Free Dmitry! Boycott Adobe! Repeal the DMCA!    http://www.freesklyarov.org
Geek for Hire                        http://kmself.home.netcom.com/resume.html

Attachment: pgpBdU7LgJMIg.pgp
Description: PGP signature


Reply to: