Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2000 15:05:10 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Peter McGarvey <Peter.McGarvey@telinco.net>
Cc:        FREEBSD-Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: BSD Theology: swap, /var, /tmp and /usr/tmp
Message-ID:  <20000502150509.B9246@fw.wintelcom.net>
In-Reply-To: <390F41FD.5880279E@telinco.net>; from Peter.McGarvey@telinco.net on Tue, May 02, 2000 at 10:00:45PM %2B0100
References:  <390F41FD.5880279E@telinco.net>

next in thread | previous in thread | raw e-mail | index | archive | help
There's a _lot_ of misinformation in this email, I'm going to
try to calrify as best I can.

* Peter McGarvey <Peter.McGarvey@telinco.net> [000502 14:32] wrote:
> Theological problem this.  Facts and Opinions welcome...
> 
> Okay, I /think/ I know what I'm doing when I slice-up a disk for a
> FreeBSD system...
> 
> 	/ -> 64MB
> 	swap -> 2 * memory (rounded-up to the nearest MB)
> 	/usr -> the remaining disk
> 
> Once setup I link /var and /tmp to /usr/var and /usr/temp
> 
> This is the way I've always done it, I'm quite happy doing it this way,
> it works for me and I've never had any problems.

Ok, so then do that.

> 
> Fine, but now some upstart has asked me to set up a FreeBSD system with
> the following....
> 
> 	/ -> 5MB
> 	swap 1 -> 512MB (equal to memory)
> 	swap 2 -> 512MB 
> 	/var -> 2GB
> 	/tmp -> 2GB
> 	/usr -> remaining disk
> 
> My first instinct is that the guy is barking mad (he is a Linux groupie
> so... (and Linux does have a nasty habit of apropriating every entry in
> the partition table))
> 
> However I've hit a snag - when it comes to FreeBSD partitions and slices
> I know the HOW (and there is lot's of help on that), but I'm not too
> sure of the WHY (and help here is lacking).
> 
> 1. What I need is some rational reasoning why the way I do 
>    things is right/wrong. 

Your setup is ok for a desktop machine, but this guy has _some_ clue
as to how to partition for a server.

Basically he's setting things up in such a way that:

  1) he has ample storage for logs and mail
  2) ample space for temp files
  3) 1&2 don't get in each others way so if log files happen to fill up
     /var, then the machine will still be able to do temp files

> 2. Why the way Linux man wants it is right/wrong.

  I would say it's a pretty good way to setup the box.

> 
> 3. Some info on the optimal size of swap

The optimal size of swap is about 50-100% more than you think you'll
ever need.  There's no failsafe magic number, the idea is to make sure
you have enough but at the same time not waste too much disk.

Now I do have a problem with setting up 1024 megs for swap, because
if you ever dig heavily into it you're more likely to grind the machine
down to a halt by thrashing.  However if you may have several large
foot print programs running and you're not thrashing, then this would
be ok.

> 
> 4. Where's the best place to put /var and /tmp

um?

> 
> Here is what I was told...
> 
> On the issue of the 2 swap I was told two swap partitions were needed as
> "we may need to turn one off as too much swap will slow the machine
> down".  

er, why not just shrink the existing swap partition?

the only reason I know of for having multiple swap partitions is to
interleave them, basically if you have 2 swap partitions on _seperate_
disks you'll get ~2x performance when you actually need to swap.
However if you have 2 or more swap partitions on the same disk, you'll
absolutely kill performance if you try to swap to it because I'm pretty
sure FreeBSD will assume that you're smart enough NOT to do this and
will alternate between swap areas causing horrible seeks.

> Furthermore, I was told the 2*memory rule is no longer valid "once the
> physical memory has exceeded 64MB"  Can this true?  Have I needlessly
> been waisting mt HDD space by making swap too big?

Again, it's a judgement call.

> My thoughts were that swap was used as needed, when needed, and that
> pages are not swapped to disk on a whim just because the swap space
> existed (or perhaps this is how linux works so he's assuming FreeBSD
> does it this way too).

In the future we may pre-swap things out, but it's an area that needs
to be explored.

> 
> As for /var and /tmp why not link them to /usr/var and /usr/tmp.  I can
> understand putting them on physically seperate devices.  But is it
> strictly necissary to put them in their own slice?  Is there a
> performance benefit?  or a is there some extra resiliency?

It's the fact that temp files won't suffer if logs/mail fill and
vice versa.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000502150509.B9246>