Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 02 May 2000 16:28:13 -0600
From:      Chris Fedde <chris@fedde.littleton.co.us>
To:        Peter.McGarvey@telinco.net
Cc:        FREEBSD-Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: BSD Theology: swap, /var, /tmp and /usr/tmp 
Message-ID:  <200005022228.e42MSD215690@fedde.littleton.co.us>
In-Reply-To: <390F41FD.5880279E@telinco.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 02 May 2000 22:00:45 +0100  Peter McGarvey wrote:
 +------------------
 | Theological problem this.  Facts and Opinions welcome...
 +------------------

Theology 
Sociology
Economy
technology
In that order... :-)

BSD OSes have roots in systems that are not derived from the IBM
PC.  As such they had an abstraction called a "partition" long
before the IBM PC-AT had a hard drive.  When BSD met the PC it had
to do something.  So to conserve documentation effort the slice
was born.  In one document you could say that

    BSD(slice) == DOS(partition)

and apologize for the confusion that this causes.

 +------------------
 | 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
 +------------------

How many spindles are we talking about here?  There was a time when Linux
systems could not support swap partitions bigger than 128Meg.  I think that
that is gone now but the legacy lives on.  There may still be a good reason
because of the way that swap is managed to have more than one swap
partition on a single spindle I'd let that one go.  If there are two
spindles then by all means split swap over both of them.

Personal I like a small / partition.  It's best if I can fit a backup of it on
a zip drive.  That makes it much easier easy to recover. 
Assuming you have a zip drive.

I also like to have a distinct /var partition. and I typically put /tmp in
MFS because it makes VI real fast :-)

What are they doing that requires such a huge /tmp anyway? I can see a big
/var/log or maybe a big /var/www.  It might not be worth arguing about it
though.

 +------------------
 | 1. What I need is some rational reasoning why the way I do 
 |    things is right/wrong. 
 +------------------

Your way is great for the standard workstations situation.  Server configs
or even some development configs can show up different requirements.

 +------------------
 | 2. Why the way Linux man wants it is right/wrong.
 +------------------

Linux partitions = fdisk partitions.  2 primary, plus piles and piles of
extended partitions.

 +-----------------
 | 3. Some info on the optimal size of swap
 +-----------------

Again swap is an interesting issue on server configurations.  Ideally you
want to avoid having the machine doing any swap.  But that does not mean
that you should prevent swapping if the machine needs to do it.  the 2x
memory rule is a guide line.  I've set up systems that had thousands and
thousands of processes (64M ram, 4Gbyte swap) and ones that ran the same
program over and over (2Gbyte ram, no swap)

 +-----------------
 | 4. Where's the best place to put /var and /tmp
 +-----------------

Again it is application dependent.  Many apps like to put their data files
in /var.  This can lead to a requirement for a big /var partition.

/tmp should really not be used for long term storage.  Back in the olden
days fast disks were small and big disks were slow.  These days disk is
free and fast so the old rules don't make much space.  Make a big swap
partition and still map use MFS.  That way small temporary files get memory
speed performance and old static files get paged out.

 +-----------------
 | 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".  
 +-----------------

Were they laughing when they said this?  Maybe that is a problem under
linux.  Unused swap space causes no penalty on FBSD that I'm aware of.

 +-----------------
 | 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 this is a generalization.  Swap is there because ram used to
be expensive.  Today ram is cheep but disk is free. So allow enough
swap to prevent the machine from crashing when it runs out of RAM
or to back up the /tmp MFS.  Keep an eye on vmstat to be sure that
you're not thrashing and when that happens add more memory.

 +-----------------
 | Whilst I'm at it what is the difference between /tmp and /usr/tmp.  I've
 | always treated them a seperate entities - assuming linking /tmp to
 | /usr/tmp was a bad thing.  Linux man maligned FreeBSD big time when he
 | found there were two temporary directories.  I couldn't respond as I
 | didn't know - and I refused to descent to his level by insulting his
 | prefered OS.
 +-----------------

FreeBSD has a longer history than Linux and so has several anachronisms
in it's file system.  /tmp and /usr/tmp are examples of this.  /tmp
was put on a small fast disk.  /usr/tmp was on a big slow disk.
The real need for this is gone now but the practice lives on because
there has been no need to change it.  /bin and /usr/bin have a
similar history.

If you want to see something really odd look at the hierarchy in
Plan9. each user sees a custom hierarchy. they see one /bin containing
all their commands for example.  This paradigm comes from a
realization that the user should see an idealized computer.  It
vastly simplifies the user environment and in some ways makes
administration simpler at the same time.

 +-----------------
 | Like I said this is mainly a theological problem.  so all Facts and
 | Opinions welcome...
 +------------------

Please excuse me for saying it, but both of you seem to have adopted
rather provincial positions.  Go examine some conventions from
other OSes.  Even if you stay inside unixoid operating systems you
will see huge variations in the arrangement of the details.

chris

--
    Chris Fedde
    303 773 9134


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?200005022228.e42MSD215690>