Partition Size

Jerry McAllister jerrymc at clunix.cl.msu.edu
Tue Jan 25 09:10:28 PST 2005


> 
> in message <200501241943.20596.hindrich at worldchat.com>, wrote
> Peterhin thusly...
> >
> > looking at page 70, in "The Complete FreeBSD" and I quote "Use the
> > rest of the space on disk for a /home file system. as long as it's
> > possible to back it up on a single tape. Otherwise make multiple
> > file systems."
> 
> > My question is do I make multiple /home directories.? I have a
> > SATA 80GB hard drive, so as Greg L. suggests  4GB to 6GB for the
> > root file system.  1GB to 2GB for the Swap file. The rest of the
> > disk for the /home file.
> >
> > That would leave me with a  /home  of approx. 72GB.
> 
> Assuming given space is >= 4 GB ...
> 
> I personally first set the sizes of swap (2*RAM if RAM <= 256 MB,
> else about RAM + 256 MB), / (about 65% full), and /usr (about 50%
> full).
> 
> I try to keep the sizes of / (100 - 135 MB) & /usr (500-600 MB) such
> that there is room to expand w/ each, at least, minor release, w/o
> wasting space.  Purpose of the two partitions is to contain base
> system specific files only. X does not come in this yet.
> 
> Next comes the partition which will contain at least /home and non
> system files (/usr/local, /usr/X11R6, /usr/ports, /usr/src).
> 
> If i can squeeze in ~2 GB partition, then
> ${MAKEOBJDIRPREFIX:-/usr/obj} & $WRKDIRPREFIX---see comments in
> /usr/ports/Mk/bsd.port.mk---go there (where ports & system compilation
> occur).
> 
> Now, the remaining amount of space decides if /var goes on a separate
> partition.  Low space in /var will very likely make /tmp to be created
> as a memory file system.  If the amount of the remaining is too low (i
> decreed it to be <465 MB during my last installation) for /var,
> everything will go either on the partition containing /home or the
> compilation partition.

Whew, this seems to be excessively complicated!!

Presuming you are talking about one nice big FreeBSD slice on one disk,
here are the things to consider.

First, although it is possible to put everything in /  (root) there
are times it is nice to have a smaller root to work with, especially
if you have to deal with recovering from botching something up.

Secondly, you want a reasonably large swap space - more than memory
size if possible, even twice memory size, plus a little.  Swap is 
used for swap, paging and crash dumps if you need it.  The amount
you need for paging depends a lot on the amount of memory you have
and how many processes you get loaded up and running and such.  With 
disk being so cheap now, using a little more for swap is cheap and 
not a bad idea, but not essential.

Third, You want to protect the rest of your system from things that can
unexpectedly grow and overfill their partition and bring the system
to its knees.    The way to protect the system is to put these things
in a separate partition.  Some processes may grind to a halt, but
usually you can then at least get to stuff to clean up.  

The two big candidates are /tmp and /var.  You shouldn't need a giant /tmp
but having it separate provides a little protection.   /var contains logs, 
spools and databases.   The amount of space you need depends a lot on what 
you are running and how often you rotate logs and how long you keep old 
logs and how clean you keep your spool files and if you are running a 
database engine like MySQL.  Overfilling either /tmp or /var can bog 
your system down, but you can usually get to things with root and cleanup.

Fourth, you need enough space in /usr for what you install.  If you 
bring in ports (recommended) and source (needed if you are serious
about learning FreeBSD and getting creative, but otherwise optional)
and install some of the big ports, you can use up a lot of space very
fast.   

Some people put people's login directories in /usr (/usr/home/idname).
That can be one of those things that grow unexpectedly, so I don't.

Some people leave /usr in the root (/) partition.   That is fine, just
makes root bigger and makes it slightly more likely that you won't be
able to just mount root to clean up problems after botching something.  

Fifth, the rest of the space...  It is common to make up a large
partition to hold all of the rest of everything, which can be login
directories, scratch files, etc.   A popular name to use for mounting
this partition is /home.   I also use /work and even /junk. 

This 'rest of the disk' should be divided up into chunks that can
be dump(8)ed to one backup media if possible.   Otherwise you will
get sloppy and not do backups because it is harder.  Since there is a 
limit to how many partitions that can be created in one slice, you may 
need to make more than one slice to do this chunking up.  This is no
problem if your machine is dedicated to FreeBSD.   If you are multi
booting it, you may run out of slices too - only 4 are allowed.  But, 
then, if you are multi booting and using up all the slices, you 
probably will also be using up a bunch of the disk space on those
other OSen and won't need to do so much chunking of the FreeBSD slice.

Finally, it is a common practice to move some of those parts that can
be big or grow unexpectedly in to that 'rest of the disk' partition
and then make symbolic links to then in their native space.  Good
candidates for such moves are /usr/ports, /usr/local, /usr/share,
/usr/src, /var/spool, /var/db or maybe /var/db/mysql, /var/mail, 
/var/log though that one makes me a little nervous - you want logging 
to work even if that big partition is trashed for some reason.

Another one to consider moving to the big partition is the space
for your web site.  You can move and link that whole thing too or 
put the main page in the native place and other stuff on the other
partition[s] as needed with appropriate URLs.  Then you don't even
need Sym links (but you may need some http.conf additions).

If you do move these things, you need a lot less space in the native
partitions.   Moving all that stuff out of /var, for example can make
it reasonable to leave /var in root.    The same is true of /usr.
The two difficulties with /usr are /usr/ports and /usr/src.   You really 
want to install /usr/ports and /usr/src right when you are doing the main 
installation and move them later.   It's easier.  But, the installer
does not give you a chance to put them in an alternative partition and
make a link.   So, you either have to make /usr big enough for all that
stuff or do some nasty stuff like making the big partition mount as /usr
at first and making a little [eventual] /usr partition mounted as something
else at first and then after everything is installed. kind of reverse
divide things (eg move all the stuff you really want to keep in /usr over
to the small partition, make the links and then rename the mount points
and finally clean up).

So, just an example of what works nicely on a machine with a small MySQl
database, full source and ports and 1 GB memory on a 40GB nominal drive:

    partition size     mounted as   % full
      256 MB             /            21
    1,256 MB             swap
      512 MB             /tmp          1      Probably 256 MB is plenty
    2,048 MB             /usr         45
    3,072 MB             /var          3
   30,716 MB             /home        13

/usr/ports and /usr/local are moved to /home.  /usr/src is still in /usr. 
I didn't do anything tricky on this machine to shrink /usr.   The database 
has not been moved out of /var, but there, so far is not much in it.
     
An example of a simple one:  This is with a 36 GB nominal drive.  
It has /usr/local and /usr/share moved to /home and does not have 
/usr/src or /usr/ports on it.  Also, /var/log, /var/mail and /var/spool 
are moved to /home.  /usr and /var are left in root (/).

    partition size     mounted as   % full
      448 MB             /            44
    1,024 MB             swap
      768 MB             /tmp          1      Probably 256 MB is plenty
   32,000 MB             /home        15

If you have a second [and third] disk, slice them in to dump(8) size
chunks according to your backup media.  Probably the easiest is 1 slice
per disk and however many partitions in the slice to chunk it for
backing up.   Pick some nice meaningful mount point names and have fun.
Move over large login in directories and databases.

////jerry
      
> 
> Currently in ~22 GB slice & FreeBSD 5.3 installed, i have ...
> 
>   -------  Abbreviated "df -hi" output  ---------------
>   . Size    Used . Capacity iused . %iused  Mounted on
>   . 135M     53M .    43%    1405 .    8%   /
>   . 581M    321M .    60%   16810 .   22%   /usr
>   . 465M     41M .    10%    1776 .    3%   /var
>   .  16G    4.5G .    30%  205600 .    9%   /misc
>   . 2.7G    918M .    36%   33311 .    9%   /work
> 
> 
>   ... where, /misc has ...
> 
>     drwxr-xr-x   3 root  wheel   512 Dec 21 21:57 home/
>     drwxr-xr-x  21 root  wheel   512 Jan 14 00:10 local/
>     drwx------   2 root  wheel  2048 Jan 21 07:45 lost+found/
>     drwxr-xr-x  10 root  wheel   512 Dec 28 15:06 moo/
>     drwxr-xr-x   2 root  wheel   512 Dec 30 20:54 nfs/
>     lrwxr-xr-x   1 root  wheel     9 Dec 23 18:07 obj@ -> /work/obj
>     lrwxr-xr-x   1 root  wheel    13 Jan  3 18:26 ports@ -> ports-current
>     drwxr-xr-x  52 root  wheel  1536 Jan 24 23:05 ports-current/
>     drwxr-xr-x   6 root  wheel   512 Jan  3 18:25 ports-mozilla-1.7.3/
>     drwxr-xr-x   7 root  wheel  1024 Jan  3 18:24 ports-netscape4/
>     lrwxr-xr-x   1 root  wheel     7 Dec 21 23:00 src@ -> src-5.3
>     drwxr-xr-x  21 root  wheel  1024 Jan 17 21:45 src-5.3/
>     drwxr-xr-x   6 root  wheel   512 Dec 31 08:54 sup/
> 
>     (moo contains things like locally developed programs/scripts,
>     configurations, etc. which are installed by
>     something-other-than-myself.  sup contains data created by cvsup;
>     ports-{moz,netscape}* contain ports view at the time of
>     mozilla-1.7.3 & netscape4 ports respectively.)
> 
> 
>   ... and /work has ...
> 
>     drwx------  3 root  wheel  2048 Jan 21 07:44 lost+found/
>     drwxr-xr-x  3 root  wheel   512 Dec 22 19:07 obj/
>     drwxr-xr-x  3 root  wheel   512 Jan  4 20:56 ports/
>     drwxrwxrwt  3 root  wheel   512 Jan 24 22:45 tmp/
> 
> 
>   ... finally in / & /usr (abbreviated to show only rearrangement of
>   defaults) ...
> 
>     lrwxr-xr-x  1 root  wheel   9 Dec 21 15:43 /home@ -> misc/home
>     lrwxr-xr-x  1 root  wheel   8 Dec 21 15:39 /tmp@ -> work/tmp
>     lrwxr-xr-x  1 root  wheel  11 Dec 21 15:40 /usr/local@ -> /misc/local
>     lrwxr-xr-x  1 root  wheel  13 Dec 21 15:40 /usr/X11R6@ -> /misc/local/X
>     lrwxr-xr-x  1 root  wheel  11 Dec 22 01:16 /usr/ports@ -> /misc/ports
>     lrwxr-xr-x  1 root  wheel   9 Dec 21 15:42 /usr/src@ -> /misc/src
>     lrwxr-xr-x  1 root  wheel   9 Dec 21 15:48 /usr/obj@ -> /work/obj
> 
> 
>   ... and to keep ports system from misbehaving, /etc/make.conf has ...
> 
>     LOCALBASE=/misc/local
>     X11BASE=/misc/local/X
>     PORTSDIR=/misc/ports
>     WRKDIRPREFIX=/work/ports
> 
> 
> Mind that above is my own brand of fuzzy logic to partitioning a slice
> for personal use; besides the / & /usr partitions sizes, everything is
> subject to major changes.
> 
> 
> After doing quite a number of installations, i am still not satisfied
> w/ the layout.  I thought i was quite done w/ 4.x, but 5.x changed
> that being bigger in size, especially /.  And the partitioning
> menu/screen, reached via sysinstall->Configure, sometimes does not
> allow some of the values (causes "Partition too big" error message)
> causing some partitions to be bigger/smaller than desired.
> 
> Oh well.
> 
> 
>   - Parv
> 
> -- 
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 



More information about the freebsd-questions mailing list