From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
Newsgroups: comp.os.linux
Subject: Re: Optimal Partition Sizes
Date: 14 Dec 92 16:03:25 GMT
Organization: University of Helsinki

danubius@halcyon.com (Joseph R. Pannon) writes:
>Given plenty of HD space, could somebody provide some guidelines about
>the optimal partition sizes for root, usr and swap partitions? 

Here is something that I have outlined write for the sysadmin guide
(and/or the installation instructions).  It is VERY quick and dirty
(first draft), and will probably be rewritten a few times before if is
ready.  Hopefully it is usable even now.  Comments are welcome, of
course.

       * Allocating swap space

       How much swap space do you need?  Many people will tell you
       that you should allocate twice as much swap space as you have
       physical memory, but this is bogus.  Here's how to do it:
       
       1.  Estimate your total memory needs.  This is the largest
           amount of memory you'll probably need at a time, that is
           the sum of the memory requirements of all the programs you
           want to run at the same time.  For instance, if you want
           to run X, you should allocate about 8 MB (???) for it, gcc
           wants several megabytes, etc.  The kernel will use about a
           megabyte by itself, and the usual shells and other small
           utilities perhaps a few hundred kilobytes (say a meg
           together).  There is no need to try to be exact, rough
           estimates are fine.
       
       2.  Add some security to the estimate in step 1.  This is
           because estimates of program sizes will probably be wrong,
           because you'll probably forget some programs you want to
           run, and to make certain that you have some extra space
           just in case.  A couple of megabytes should be fine.  (It
           is better to allocate too much than too little swap space,
           but there's no need to overdo it and allocate the whole
           disk, since unused swap space is wasted space.)  Also,
           since it is nicer to deal with even numbers, you can round
           the value up to the next full megabyte.
       
       3.  Based on the computations in steps 1 and 2, you know how
           much memory you'll be needing in total.  So, in order to
           allocate swap space, you only need to subtract the size of
           your physical memory from the total memory need, and you
           know how much swap space you need.
       
       The next issue is to decide whether you want to use a separate
       swap partition, or a file in the file system.  The swap
       partition is faster, but it is easier to change the size of a
       swap file (there's no need to repartition the whole hard disk,
       and possibly install everything from scratch).  When you know
       how much swap space you need, you should go for a swap
       partition, but if you are uncertain, you can use a swap file
       first, use the system for a while so that you can get a feel
       for how much swap you need, and then make a swap partition
       when you're confident about its size.

About the root and usr partitions, I have not yet thought much about,
but I guess the general consensus is that root should be as small as
you can comfortably get away with (basically, it should contain only
the crucial things), and usr should be as big as possible, especially
if you put the home directories there.

However, for small disks several partitions easily makes life
miserable.  For instance, I used to have four partitions on my 109 MB
hard disk: 32 MB for DOS, 10 MB for root (including 4 MB swap file),
16 MB for home, and 51 MB for usr.  I usually had about 20-25 MB free
space, which divided into four partitions is not a lot.  Even worse,
most of the free space was on the DOS partition and not terribly
useful for Linux use.  So even though I had a lot of free space, I
couldn't really use it, since it was usually only about 3-4 MB per
partition, and it is surprising how quickly one can fill that.

Now I have three partitions: 20 MB for DOS, 10 MB for swap, and 79 MB
for Linux.  Yes, I have everything in one partition, and it is using
the extended filesystem.  I DO NOT RECOMMEND this for people who
dislike living dangerously.  The extended filesystem is still alpha,
and only fools such as I risk all their data on it.  The extfs is also
not as fast as it could be.  I decided that I can't live with 14
character filenames anymore, nor with the cramped feeling of four
partitions.  I guess I can live with disappearing data and
re-installing everything once a day. :-)  (NO, the extfs isn't that
bad; I've had exactly one problem with it during several weeks.  And I
try to do backups regularly.)

--
Lars.Wirzenius@helsinki.fi  (finger wirzeniu@klaava.helsinki.fi)
   MS-DOS, you can't live with it, you can live without it.
Newsgroups: comp.os.linux