Whitespace from previous commit.

Whitespace in other areas.
Use &os; for FreeBSD in several different locations.
This commit is contained in:
Tom Rhodes 2003-10-10 19:57:55 +00:00
parent 554ed7031e
commit ad4a7798d2
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=18380

View file

@ -37,11 +37,11 @@
<indexterm><primary>system configuration</primary></indexterm>
<indexterm><primary>system optimization</primary></indexterm>
<para>One of the important aspects of FreeBSD is system configuration.
<para>One of the important aspects of &os; is system configuration.
Correct system configuration will help prevent headaches during future upgrades.
This chapter will explain much of the FreeBSD configuration process,
This chapter will explain much of the &os; configuration process,
including some of the parameters which
can be set to tune a FreeBSD system.
can be set to tune a &os; system.
</para>
<para>After reading this chapter, you will know:</para>
@ -66,7 +66,7 @@
<filename>/etc</filename>.</para>
</listitem>
<listitem>
<para>How to tune FreeBSD using <command>sysctl</command>
<para>How to tune &os; using <command>sysctl</command>
variables.</para>
</listitem>
<listitem>
@ -79,11 +79,11 @@
<itemizedlist>
<listitem>
<para>Understand &unix; and FreeBSD basics (<xref
<para>Understand &unix; and &os; basics (<xref
linkend="basics">).</para>
</listitem>
<listitem>
<para>Be familiar with keeping FreeBSD sources up to date
<para>Be familiar with keeping &os; sources up to date
(<xref linkend="cutting-edge">), and
the basics of kernel configuration/compilation
(<xref linkend="kernelconfig">).</para>
@ -367,7 +367,7 @@ esac
exit 0
</programlisting>
<para>The startup scripts of FreeBSD will look in
<para>The startup scripts of &os; will look in
<filename>/usr/local/etc/rc.d</filename> for scripts that have an
<literal>.sh</literal> extension and are executable by
<username>root</username>. Those scripts that are found are called with
@ -391,7 +391,7 @@ exit 0
<para>Some additional system services may not be covered by the
toggles in <filename>/etc/rc.conf</filename>. These are
traditionally enabled by placing the command(s) to invoke them
in <filename>/etc/rc.local</filename>. As of FreeBSD&nbsp;3.1 there
in <filename>/etc/rc.local</filename>. As of &os;&nbsp;3.1 there
is no default <filename>/etc/rc.local</filename>; if it is
created by the administrator it will however be honored in the
normal fashion. Note that <filename>rc.local</filename> is
@ -433,7 +433,7 @@ exit 0
<indexterm><primary>cron</primary>
<secondary>configuration</secondary></indexterm>
<para>One of the most useful utilities in FreeBSD is &man.cron.8;. The
<para>One of the most useful utilities in &os; is &man.cron.8;. The
<command>cron</command> utility runs in the background and constantly
checks the <filename>/etc/crontab</filename> file. The <command>cron</command>
utility also checks the <filename>/var/cron/tabs</filename> directory, in
@ -445,9 +445,9 @@ exit 0
<para>Let us take a look at the <filename>/etc/crontab</filename> file:</para>
<programlisting># /etc/crontab - root's crontab for FreeBSD
<programlisting># /etc/crontab - root's crontab for &os;
#
# &dollar;FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp &dollar;
# &dollar;&os;: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp &dollar;
# <co id="co-comments">
#
SHELL=/bin/sh
@ -569,7 +569,7 @@ HOME=/var/log
<indexterm><primary>rcNG</primary></indexterm>
<para>FreeBSD has recently integrated the NetBSD
<para>&os; has recently integrated the NetBSD
<filename>rc.d</filename> system for system initialization.
Users should notice the files listed in the
<filename>/etc/rc.d</filename> directory. Many of these files
@ -685,7 +685,7 @@ sshd is running as pid 433.</screen>
</listitem>
<listitem>
<para>KEYWORD: FreeBSD or NetBSD. This is used for *BSD dependent features.</para>
<para>KEYWORD: &os; or NetBSD. This is used for *BSD dependent features.</para>
</listitem>
</itemizedlist>
@ -716,7 +716,7 @@ sshd is running as pid 433.</screen>
<para>Nowadays we can not think about a computer without thinking
about a network connection. Adding and configuring a network
card is a common task for any FreeBSD administrator.</para>
card is a common task for any &os; administrator.</para>
<sect2>
<title>Locating the Correct Driver</title>
@ -728,7 +728,7 @@ sshd is running as pid 433.</screen>
<para>Before you begin, you should know the model of the card
you have, the chip it uses, and whether it is a PCI or ISA card.
FreeBSD supports a wide variety of both PCI and ISA cards.
&os; supports a wide variety of both PCI and ISA cards.
Check the Hardware Compatibility List for your release to see
if your card is supported.</para>
@ -811,7 +811,7 @@ lo0: flags=8049&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; mtu 16384
tun0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1500</screen>
<note>
<para>Old versions of FreeBSD may require the <option>-a</option>
<para>Old versions of &os; may require the <option>-a</option>
option following &man.ifconfig.8;, for more details about the
correct syntax of &man.ifconfig.8;, please refer to the manual
page. Note also that entries concerning IPv6
@ -848,7 +848,7 @@ tun0: flags=8010&lt;POINTOPOINT,MULTICAST&gt; mtu 1500</screen>
</listitem>
</itemizedlist>
<para>FreeBSD uses the driver name followed by the order in
<para>&os; uses the driver name followed by the order in
which one the card is detected at the kernel boot to name the
network card. For example <devicename>sis2</devicename> would
be the third network card on the system using the &man.sis.4;
@ -1016,9 +1016,9 @@ round-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</screen>
a pain, and a pain which can be alleviated by checking the simple
things first. Is your network cable plugged in? Have you properly
configured the network services? Did you configure the firewall
correctly? Is the card you are using supported by FreeBSD? Always
correctly? Is the card you are using supported by &os;? Always
check the hardware notes before sending off a bug report. Update
your version of FreeBSD to the latest STABLE version. Check the
your version of &os; to the latest STABLE version. Check the
mailing list archives, or perhaps search the Internet.</para>
<para>If the card works, yet performance is poor, it would be
@ -1058,10 +1058,10 @@ round-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</screen>
<para>Sometimes performance of the card is poor, or below average.
In these cases it is best to set the media selection mode
from <literal>autoselect</literal> to the correct media selection. While this usually works
for most hardware, it may not resolve this issue for everyone.
Again, check all the network settings, and read over the
&man.tuning.7; manual page.</para>
from <literal>autoselect</literal> to the correct media selection.
While this usually works for most hardware, it may not resolve
this issue for everyone. Again, check all the network settings,
and read over the &man.tuning.7; manual page.</para>
</sect3>
</sect2>
@ -1073,7 +1073,7 @@ round-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</screen>
<indexterm><primary>virtual hosts</primary></indexterm>
<indexterm><primary>IP aliases</primary></indexterm>
<para>A very common use of FreeBSD is virtual site hosting, where
<para>A very common use of &os; is virtual site hosting, where
one server appears to the network as many servers. This is
achieved by assigning multiple network addresses to a single
interface.</para>
@ -1196,7 +1196,7 @@ round-trip min/avg/max/stddev = 0.700/0.729/0.766/0.025 ms</screen>
<primary><filename>resolv.conf</filename></primary>
</indexterm>
<para><filename>/etc/resolv.conf</filename> dictates how FreeBSD's
<para><filename>/etc/resolv.conf</filename> dictates how &os;'s
resolver accesses the Internet Domain Name System (DNS).</para>
<para>The most common entries to <filename>resolv.conf</filename> are:
@ -1253,7 +1253,7 @@ nameserver 147.11.100.30</programlisting>
local record of Internet names, reducing the need to query
externally for commonly accessed names.</para>
<programlisting># &dollar;FreeBSD&dollar;
<programlisting># &dollar;&os;&dollar;
#
# Host Database
# This file should contain the addresses and aliases
@ -1312,7 +1312,7 @@ nameserver 147.11.100.30</programlisting>
of <command>syslog</command> messages are logged to particular
log files.</para>
<programlisting># &dollar;FreeBSD&dollar;
<programlisting># &dollar;&os;&dollar;
#
# Spaces ARE valid field separators in this file. However,
# other *nix-like systems still insist on using tabs as field
@ -1371,7 +1371,7 @@ cron.* /var/log/cron
certain periodic time/date.</para>
<programlisting># configuration file for newsyslog
# &dollar;FreeBSD&dollar;
# &dollar;&os;&dollar;
#
# filename [owner:group] mode count size when [ZB] [/pid_file] [sig_num]
/var/log/cron 600 3 100 * Z
@ -1410,10 +1410,10 @@ cron.* /var/log/cron
<para>A sample <filename>sysctl.conf</filename> turning off logging
of fatal signal exits and letting Linux programs know they are really
running under FreeBSD:</para>
running under &os;:</para>
<programlisting>kern.logsigexit=0 # Do not log fatal signal exits (e.g. sig 11)
compat.linux.osname=FreeBSD
compat.linux.osname=&os;
compat.linux.osrelease=4.3-STABLE</programlisting>
</sect2>
</sect1>
@ -1428,7 +1428,7 @@ compat.linux.osrelease=4.3-STABLE</programlisting>
</indexterm>
<para>&man.sysctl.8; is an interface that allows you to make changes
to a running FreeBSD system. This includes many advanced
to a running &os; system. This includes many advanced
options of the TCP/IP stack and virtual memory system that can
dramatically improve performance for an experienced system
administrator. Over five hundred system variables can be read
@ -1508,20 +1508,21 @@ kern.maxfiles: 2088 -> 5000</screen>
</indexterm>
<para>The <varname>vfs.vmiodirenable</varname> sysctl variable
may be set to either 0 (off) or 1 (on); it is 1 by default. This variable controls how
directories are cached by the system. Most directories are
small, using just a single fragment (typically 1&nbsp;K) in the
file system and less (typically 512&nbsp;bytes) in the buffer
cache. However, when operating in the default mode the buffer
may be set to either 0 (off) or 1 (on); it is 1 by default.
This variable controls how directories are cached by the
system. Most directories are small, using just a single
fragment (typically 1&nbsp;K) in the file system and less
(typically 512&nbsp;bytes) in the buffer cache.
However, when operating in the default mode the buffer
cache will only cache a fixed number of directories even if
you have a huge amount of memory. Turning on this sysctl
allows the buffer cache to use the VM Page Cache to cache the
directories, making all the memory available for caching
directories. However,
the minimum in-core memory used to cache a directory is the
physical page size (typically 4&nbsp;K) rather than 512&nbsp;bytes. We
recommend turning this option on if you are running any
services which manipulate large numbers of files. Such
physical page size (typically 4&nbsp;K) rather than 512&nbsp;
bytes. We recommend turning this option on if you are running
any services which manipulate large numbers of files. Such
services can include web caches, large mail systems, and news
systems. Turning on this option will generally not reduce
performance even with the wasted memory but you should
@ -1565,7 +1566,7 @@ kern.maxfiles: 2088 -> 5000</screen>
<para>There are various other buffer-cache and VM page cache
related sysctls. We do not recommend modifying these values. As
of FreeBSD 4.3, the VM system does an extremely good job of
of &os; 4.3, the VM system does an extremely good job of
automatically tuning itself.</para>
</sect3>
@ -1602,7 +1603,7 @@ kern.maxfiles: 2088 -> 5000</screen>
<primary><varname>hw.ata.wc</varname></primary>
</indexterm>
<para>FreeBSD&nbsp;4.3 flirted with turning off IDE write caching.
<para>&os;&nbsp;4.3 flirted with turning off IDE write caching.
This reduced write bandwidth to IDE disks but was considered
necessary due to serious data consistency issues introduced
by hard drive vendors. The problem is that IDE
@ -1611,7 +1612,7 @@ kern.maxfiles: 2088 -> 5000</screen>
to disk out of order, but will sometimes delay writing some
blocks indefinitely when under heavy disk loads. A crash or
power failure may cause serious file system corruption.
FreeBSD's default was changed to be safe. Unfortunately, the
&os;'s default was changed to be safe. Unfortunately, the
result was such a huge performance loss that we changed
write caching back to on by default after the release. You
should check the default on your system by observing the
@ -1637,11 +1638,11 @@ kern.maxfiles: 2088 -> 5000</screen>
reduce system boot times. The defaults are fairly high and can be
responsible for <literal>15+</literal> seconds of delay in the
boot process. Reducing it to <literal>5</literal> seconds usually
works (especially with modern drives). Newer versions of FreeBSD
works (especially with modern drives). Newer versions of &os;
(5.0+) should use the <varname>kern.cam.scsi_delay</varname>
boot time tunable. The tunable, and kernel config option accept
values in terms of <emphasis>milliseconds</emphasis> and <emphasis>not</emphasis>
<emphasis>seconds</emphasis>.</para>
values in terms of <emphasis>milliseconds</emphasis> and
<emphasis>not</emphasis> <emphasis>seconds</emphasis>.</para>
</sect3>
</sect2>
@ -1663,7 +1664,7 @@ kern.maxfiles: 2088 -> 5000</screen>
it is mounted. A good time to enable Soft Updates is before any
partitions have been mounted, in single-user mode.</para>
<note><para>As of FreeBSD&nbsp;4.5, it is possible to enable Soft Updates
<note><para>As of &os;&nbsp;4.5, it is possible to enable Soft Updates
at filesystem creation time, through use of the <literal>-U</literal>
option to &man.newfs.8;.</para></note>
@ -1688,9 +1689,10 @@ kern.maxfiles: 2088 -> 5000</screen>
<secondary>details</secondary>
</indexterm>
<para>There are two traditional approaches to writing a file systems meta-data
back to disk. (Meta-data updates are updates to
non-content data like inodes or directories.)</para>
<para>There are two traditional approaches to writing a file
systems meta-data back to disk. (Meta-data updates are
updates to non-content data like inodes or
directories.)</para>
<para>Historically, the default behavior was to write out
meta-data updates synchronously. If a directory had been
@ -1707,8 +1709,8 @@ kern.maxfiles: 2088 -> 5000</screen>
repair the filesystem by setting the file length to
0. Additionally, the implementation is clear and simple.
The disadvantage is that meta-data changes are slow. An
<command>rm -r</command>, for instance, touches all the files in a
directory sequentially, but each directory
<command>rm -r</command>, for instance, touches all the files
in a directory sequentially, but each directory
change (deletion of a file) will be written synchronously
to the disk. This includes updates to the directory itself,
to the inode table, and possibly to indirect blocks
@ -1872,7 +1874,7 @@ kern.maxfiles: 2088 -> 5000</screen>
connected at once, the resources needed may be similar to a
high-scale web server.</para>
<note><para>As of FreeBSD&nbsp;4.5, setting <option>MAXUSERS</option> to
<note><para>As of &os;&nbsp;4.5, setting <option>MAXUSERS</option> to
<literal>0</literal> in your kernel configuration file will choose
a reasonable default value based on the amount of RAM present in
your system.</para></note>
@ -1906,7 +1908,7 @@ kern.maxfiles: 2088 -> 5000</screen>
<para>The <option>NMBCLUSTERS</option> kernel configuration
option dictates the amount of network Mbufs available to the
system. A heavily-trafficked server with a low number of Mbufs
will hinder FreeBSD's ability. Each cluster represents
will hinder &os;'s ability. Each cluster represents
approximately 2&nbsp;K of memory, so a value of 1024 represents 2
megabytes of kernel memory reserved for network buffers. A
simple calculation can be done to figure out how many are
@ -1914,15 +1916,17 @@ kern.maxfiles: 2088 -> 5000</screen>
simultaneous connections, and each connection eats a 16&nbsp;K receive
and 16&nbsp;K send buffer, you need approximately 32&nbsp;MB worth of
network buffers to cover the web server. A good rule of thumb is
to multiply by 2, so 2x32&nbsp;MB&nbsp;/&nbsp;2&nbsp;KB&nbsp;= 64&nbsp;MB&nbsp;/&nbsp;2&nbsp;kB&nbsp;= 32768. We recommend values between 4096 and
32768 for machines with greater amounts of memory. Under no
circumstances should you specify an arbitrarily high value for this
parameter as it could lead to a boot time crash. The
<option>-m</option> option to &man.netstat.1; may be used to
observe network cluster use.</para>
to multiply by 2, so 2x32&nbsp;MB&nbsp;/&nbsp;2&nbsp;KB&nbsp;=
64&nbsp;MB&nbsp;/&nbsp;2&nbsp;kB&nbsp;= 32768. We recommend
values between 4096 and 32768 for machines with greater amounts
of memory. Under no circumstances should you specify an
arbitrarily high value for this parameter as it could lead to a
boot time crash. The <option>-m</option> option to
&man.netstat.1; may be used to observe network cluster
use.</para>
<para><varname>kern.ipc.nmbclusters</varname> loader tunable should
be used to tune this at boot time. Only older versions of FreeBSD
be used to tune this at boot time. Only older versions of &os;
will require you to use the <option>NMBCLUSTERS</option> kernel
&man.config.8; option.</para>
@ -2059,9 +2063,9 @@ kern.maxfiles: 2088 -> 5000</screen>
<para>Swapping over NFS is only recommended if you do not have a
local hard disk to swap to. Swapping over NFS is slow and
inefficient in versions of FreeBSD prior to 4.X. It is
inefficient in versions of &os; prior to 4.X. It is
reasonably fast and efficient in 4.0-RELEASE and newer. Even
with newer versions of FreeBSD, NFS swapping will be limited
with newer versions of &os;, NFS swapping will be limited
by the available network bandwidth and puts an additional
burden on the NFS server.</para>
</sect2>
@ -2075,7 +2079,7 @@ kern.maxfiles: 2088 -> 5000</screen>
want, of course.</para>
<example>
<title>Creating a Swapfile on FreeBSD 4.X</title>
<title>Creating a Swapfile on &os; 4.X</title>
<orderedlist>
<listitem>
@ -2121,7 +2125,7 @@ kern.maxfiles: 2088 -> 5000</screen>
</example>
<example>
<title>Creating a Swapfile on FreeBSD 5.X</title>
<title>Creating a Swapfile on &os; 5.X</title>
<orderedlist>
<listitem>
@ -2192,10 +2196,10 @@ kern.maxfiles: 2088 -> 5000</screen>
monitor system limits (and possibly alert you) in case your system
temperature increased unexpectedly.</para>
<para>In this section of the FreeBSD Handbook, we will provide
<para>In this section of the &os; Handbook, we will provide
comprehensive information about <acronym>ACPI</acronym>. References
will be provided for further reading at the end. Please be aware
that <acronym>ACPI</acronym> is only available on FreeBSD&nbsp;5.X and
that <acronym>ACPI</acronym> is only available on &os;&nbsp;5.X and
above.</para>
<sect2 id="acpi-intro">
@ -2207,12 +2211,14 @@ kern.maxfiles: 2088 -> 5000</screen>
hardware resources and power management (hence the name).
It is a key element in <emphasis>Operating System-directed
configuration and Power Management</emphasis>, i.e.: it provides
more control and flexibility to the operating system (<acronym>OS</acronym>).
Modern systems <quote>stretched</quote> the limits of the current
Plug and Play interfaces (such as APM, which is used in FreeBSD&nbsp;4.X),
prior to the introduction of <acronym>ACPI</acronym>. <acronym>ACPI</acronym>
is the direct successor to <acronym>APM</acronym> (Advanced Power
Management).</para>
more control and flexibility to the operating system
(<acronym>OS</acronym>).
Modern systems <quote>stretched</quote> the limits of the
current Plug and Play interfaces (such as APM, which is used in
&os;&nbsp;4.X), prior to the introduction of
<acronym>ACPI</acronym>. <acronym>ACPI</acronym> is the direct
successor to <acronym>APM</acronym>
(Advanced Power Management).</para>
</sect2>
<sect2 id="acpi-old-spec">
@ -2248,7 +2254,7 @@ kern.maxfiles: 2088 -> 5000</screen>
so the OS has to use 16-bit emulation in order to
<quote>interface</quote> with PNPBIOS methods.</para>
<para>The FreeBSD <acronym>APM</acronym> driver is documented in
<para>The &os; <acronym>APM</acronym> driver is documented in
the &man.apm.4; manual page.</para>
</sect2>