The Complete FreeBSDGregLehey2001Greg LeheyIntroductionFreeBSD is a state of the art operating system derived from AT&T's UNIX
operating system.
FreeBSD no longer contains any AT&T proprietary code, so it may be distributed
freely. See page for more details.
It runs on the following platforms:
Personal computers based on the Intel i386 CPU architecture, including the 386,
486 and Pentium families of processors, and compatible CPUs from AMD and Cyrix.
The
Compaq/Digital Alpha processor.
In addition, significant development efforts are going towards porting FreeBSD
to other hardware, notably the MIPS R4000 series and the Sun Sparc.
This book only describes the released versions of FreeBSD for Intel and Alpha
processors.
How to use this bookThis book is divided into five parts:
The first part, chapters to , tells you how to install
FreeBSD and what to do if things go wrong.
Chapters to introduce you to life with FreeBSD,
including setting up optional features, building custom kernels and keeping up
to date with FreeBSD.
Chapters to introduce you to FreeBSD's rich
network support.
manpages
Starting on page you'll find selected man pages, the definitive
documentation for most of the system. I have chosen those pages most likely to
be needed before the system is installed, or while upgrading. Once the system
is running, it's easier to read them on-line.
The appendices start on page and include a large amount of
reference material.
In more detail, we'll discuss the following subjects:
In the rest of this chapter, we'll look at what FreeBSD is, what you need to run
it, and what resources are available:
On page we'll look at FreeBSD's features.
Starting on page we'll look at how FreeBSD came to be.
On page we'll compare FreeBSD to other free UNIX-like operating
systems.
On page we'll look at other sources of information about FreeBSD.
On page , we'll look at the world-wide FreeBSD community.
On page we'll consider what kinds of support are available for
FreeBSD.
Finally, on page we'll look at the BSD's emblem, the dæmon on the cover
of this book.
, discusses the installation requirements and theoretical
background of installing FreeBSD. You don't really need to read this
chapter, but it'll make you feel a whole lot more confident if you do.
, describes the changes that have taken place in FreeBSD since the
introduction of version 3.
, presents a quick installation overview. If you're
reasonably experienced, this may be all you need to install FreeBSD. Otherwise,
read on...
In , we'll walk through a typical installation. Read this chapter
if you are installing FreeBSD on a disk by itself.
In , we'll look at the differences you will encounter if you
install FreeBSD on a system which already contains another operating system.
, discusses what to do if you run into problems during or after
installation.
, describes the thousands of free software packages which you can
optionally install on a FreeBSD system.
, tells you how to set up XFree86, the Intel 386 architecture
implementation of the industry standard X11 Windowing System.
In , we'll look at the theory behind getting X11 working.
, presents a number of aspects of FreeBSD which are of interest
to newcomers (particularly from a Microsoft environment), in particular the
concepts of users and processes. We'll also consider the basics
of using the shell, as well as the importance of timekeeping.
, describes how to start and stop a FreeBSD system and all the
things you can do to customize it. In particular, we'll look at the more common
configuration files and what they should contain.
, contains information about the FreeBSD directory structure and
device names. You'll find the section on device names (starting on page
) interesting even if you're an experienced UNIX hacker.
, describes how to format and integrate hard disks, and how to handle
disk errors.
FreeBSD provides professional, reliable data backup services as part of the base
system. Don't ever let yourself lose data because of inadequate backup
provisions. Read all about it in .
, describes the BSD spooling system and how to use it both on
local and networked systems.
, describes the user's viewpoint of FreeBSD. UNIX has come a long
way in the last few years—make yourself comfortable.
, discusses how to build a customized version of FreeBSD.
In , we'll discuss how to ensure that your system is always running
the most appropriate version of FreeBSD.
FreeBSD can run software written for a number of other operating systems. Read
about it in .
Starting at , we'll look at the Internet and the more important
services.
, describes how to set up local networking.
, discusses the issues in selecting an Internet Service Provider (ISP)
and establishing a presence on the Internet.
, discusses serial hardware and the prerequisites for PPP and SLIP
communications.
In , we look at FreeBSD's two PPP implementations and what it takes to
set them up.
In , we look at two older serial communication protocols.
In , we'll consider the use of names on the Internet.
Security is an increasing problem on the Internet. In , we'll
look at some things we can do to improve it. We'll also look at IP
aliasing, since it goes hand-in-hand with firewalls.
Networks sometimes become notworks. In , we'll see what
we can do to solve network problems.
, describes Sun's classic system for sharing file systems between
networked computers.
We'll look at the basic network access programs in .
Despite the World Wide Web, traditional two-way personal communication is still
very popular. We'll look at it in .
Most people think the World Wide Web is the Internet. We'll look at
both client and server access in .
Computers can send faxes a lot more cheaply and flexibly than fax machines.
We'll look at how to do that with FreeBSD in .
Before Microsoft and Novell discovered the Internet, they created a number of
less powerful networking systems, some of which are still in use. We'll look at
them in .
, explains some of the terms used in this book.
In , we'll look at Microsoft's MS-DOS commands and how to perform
similar functions with FreeBSD.
, suggests some books for further reading.
Finally, , contains the licence agreements under which FreeBSD
software is distributed.
FreeBSD features
As we have seen, FreeBSD runs on Intel and compatible processors. It is derived
from ``Berkeley UNIX'', the flavour of UNIX developed by the Computer Systems
Research Group at the University of California at Berkeley and previously
released as the Berkeley Software Distribution (BSD) of UNIX.
For copyright reasons, FreeBSD may not be called UNIX. You be the judge of how
much difference this makes.
FreeBSD provides you with
many advanced features previously available only on much more expensive
computers, including:
FreeBSD on the Intel platform is a 32-bit operating system. Unlike some
commercial so-called ``32 bit operating systems'', it contains no 16-bit code
whatsoever. The Intel i386 architecture runs significantly faster in 32 bit
mode than in 16 bit mode, so this translates to a significantly higher
performance.
On the Alpha platform, FreeBSD is a 64 bit operating system.
preemptivemultitaskingmultitasking
FreeBSD uses preemptive multitasking with dynamic priority adjustment to
ensure smooth and fair sharing of the computer between applications and users.
multiuser
FreeBSD is a multi-user system: many people can use a FreeBSD system
simultaneously for unrelated purposes. The system shares peripherals such as
printers and tape drives properly between all users on the system.
TCP/IP
FreeBSD provides complete TCP/IP networking including SLIP, PPP, NFS and
NIS support. This means that your FreeBSD machine can interoperate easily with
other systems and also act as an enterprise server, providing vital functions
such as NFS (remote file access) and e-mail services, or putting your
organization on the Internet with WWW, ftp, routing and firewall (security)
services. In addition, the Ports Collection includes software for communicating
with proprietary protocols—see for more details.
memoryprotectionMemory protection ensures that neither applications nor users can
interfere with each other. If an application crashes, it cannot affect other
running applications.
XWindow SystemX11R6graphicaluser interfaceGUIXFree86
FreeBSD includes the XFree86 implementation of the industry standard
X Window System (X11R6) graphical user interface
(GUI).
binarycompatibilitycompatibilitySCOcompatibilityBSD/OScompatibilityLinuxcompatibilityNetBSDcompatibility386BSDSCOcompatibilityBSD/OScompatibilityNetBSDcompatibility386BSDcompatibilityLinuxcompatibility
FreeBSD can run most programs built for SCO UNIX and UnixWare, Solaris on the
i386 platform, BSD/OS, NetBSD, 386BSD, and Linux.
The FreeBSD ports and packages collection includes over two thousand
ready-to-run applications.
Thousands of additional and easy-to-port applications are available on the
Internet. FreeBSD is source code compatible with most popular commercial UNIX
systems and thus most applications require few, if any, changes to compile.
Most freely available software was developed on BSD-like systems. As a result,
FreeBSD is one of the easiest platforms you can port to.
virtualmemorymemoryvirtual
Demand paged virtual memory (VM) and ``merged VM/buffer cache''
design efficiently satisfies applications with large appetites for memory while
still maintaining interactive response to other users.
sharedlibrarieslibrariessharedShared libraries (the UNIX equivalent of Microsoft's DLLs) provide for
efficient use of disk space and memory.
The base system contains a full complement of C, C++ and Fortran development
tools. Many additional languages for advanced research and development are also
available in the ports and packages collection.
sourcecode
FreeBSD comes with source code for the entire system, so you have the
greatest degree of control over your environment.
onlinedocumentationdocumentationonlinemanpagesonlinehandbookhandbookonline
Extensive online documentation, including traditional man pages and
a hypertext-based online handbook.
FreeBSD is based on the 4.4BSD-Lite release from the Computer Systems Research
Group (CSRG) at the University of California at Berkeley, and carries on the
distinguished tradition of BSD systems development. Building on the excellent
base provided by CSRG, the FreeBSD Project has spent many thousands of hours
fine tuning the system for maximum performance and reliability in real-life load
situations. FreeBSD's features, performance and reliability compare very
favourably with those of commercial operating systems.
The applications to which FreeBSD can be put are truly limited only by your own
imagination. From software development to factory automation, inventory control
to azimuth correction of remote satellite antennae: with FreeBSD, you can do
just about anything that you could do with a commercial UNIX product. FreeBSD
benefits significantly from thousands of high quality applications developed by
research centers and universities around the world, often available at little or
no cost. Commercial applications are also available and appearing in greater
numbers every day.
Because the source code for FreeBSD itself is generally available, the system
can easily be customized for special applications or projects, in ways not
generally possible with operating systems from commercial vendors. You can
easily start out small with an inexpensive 386 class PC and upgrade as your
enterprise grows. Here is just a sampling of some of the applications in which
people currently use FreeBSD:
InternetServicesInternet Services: the Internet grew up around Berkeley UNIX. The
original TCP/IP implementation, released in 1982, was based on 4.2BSD, and
nearly every current TCP/IP implementation has borrowed from it. FreeBSD
includes this implementation, the most mature TCP/IP available at any price.
This makes it an ideal platform for a variety of Internet services such as FTP
servers, World Wide Web servers, Gopher servers, Electronic Mail servers, USENET
News servers, and Bulletin Board Systems. Need a new router? A DNS name
server? A firewall to keep people out of your internal network? FreeBSD can
easily turn that unused 386 or 486 PC sitting in the corner into an advanced
router with sophisticated packet filtering capabilities.
Education: Are you a student of computer science or a related engineering
field? There is no better way of learning about operating systems, computer
architecture and networking than the hands on, under the hood experience that
FreeBSD can provide. A number of freely available CAD, mathematical and graphic
design packages also make it highly useful to those whose primary interest in a
computer is to get other work done.
Research: With source code for the entire system available, FreeBSD is an
excellent platform for research in operating systems as well as other branches
of computer science. FreeBSD's freely available nature also makes it possible
for remote groups to collaborate on ideas or shared development without having
to worry about special licensing agreements or limitations on what may be
discussed in open forums.
XWindow workstationX Window workstation: FreeBSD makes an excellent choice for an
inexpensive X terminal solution, either using the freely available XFree86
server or one of the excellent commercial servers provided by XI Graphics,
Inc.
XIGraphics
See http://www.xig.com for further information about XI Graphics.
Unlike an X terminal, FreeBSD allows many applications to be run locally, if
desired, thus relieving the burden on a central server. FreeBSD can even boot
``diskless'', making individual workstations even cheaper and easier to
administer.
softwaredevelopmentSoftware Development: The basic FreeBSD system comes with a full
complement of development tools included the renowned GNU C/C++ compiler and
debugger.
A little history
FreeBSD is a labour of love: big commercial companies produce operating systems
and charge lots of money for them. The FreeBSD team produces a
professional-quality operating system and gives it away. That's not the only
difference.
QDOSQuickand Dirty Operating System
In 1981, when IBM introduced their Personal Computer, the microprocessor
industry was still in its infancy. The PC had a minimum of 16 kB and a maximum
of 64 kB on-board memory. UNIX wouldn't run on this hardware, so Microsoft, who
at the time marketed their own version of UNIX, went looking for something
simpler. The ``operating system'' they chose was correspondingly primitive: a
clone of Digital Resarch's successful CP/M operating system, written by Tim
Patterson of Seattle Computer Products and originally called QDOS
(Quick and Dirty Operating System).
At the time, it seemed just the
thing: it would run just fine without a hard disk (in fact, the original PC
didn't have a hard disk, not even as an option), and it didn't use up
too much memory. The only thing that they really had to do was to change the
name. Since the operating system was for IBM, they named it PC-DOS after
DOS/360, an operating system of the mid-60s. Microsoft marketed its version
under the name MS-DOS.
CSRGBerkeleyUNIX
By this time, a little further down the West Coast of the USA, the Computer
Systems Research Group (CSRG)
of the University of California at
Berkeley had just modified AT&T's UNIX operating system to run on the new DEC
VAX 11/780 machine, which sported virtual memory, and had turned their attention
to implementing some new protocols for the ARPANET: the so-called Internet
Protocols. The version of UNIX that they had developed was now sufficiently
different from AT&T's system that it had been dubbed Berkeley UNIX.
FastFile SystemUNIXFile System
As time went on, both MS-DOS and UNIX evolved. Before long MS-DOS was modified
to handle hard disks—not well, but it handled them, and for the PC users, it
was so much better than what they had before that they ignored the
inefficiencies. After all, the PC gave you your own hard disk on your desk, and
you didn't have to share it with all the other people in the department.
Microsoft even tried to emulate the UNIX directory structure, but only succeeded
in implementing the concept of nested directories. At Berkeley, they were
developing a higher performance disk subsystem, the Fast File System,
now known as the UNIX File System.
By the late 80s, it was evident that Microsoft no longer intended to
substantially enhance MS-DOS. New processors with support for multitasking and
virtual memory had replaced the old Intel 8088 processor of the IBM PC, but they
still ran MS-DOS by emulating the 8088 processor, which was now completely
obsolete. The 640 kB memory limit of the original PC, which once appeared
bigger than anybody would ever need, became a serious problem. In addition,
people wanted to do more than one thing at a time with their computers.
A solution to both problems was obvious: move to the 32 bit address mode of the
new Intel 80386 processor and introduce real multitasking, which operating
systems on larger machines had had for decades. Of course, these larger
machines were only physically larger. The average PC of 1990 had more memory,
more disk and more processing power than just about any of the large computers
of the 70s. Nevertheless, Microsoft still hasn't solved these problems for its
desktop ``operating system'', Windows 95.
ResearchVersionBerkeleySoftware DistributionSystemVSantaCruz Operation
UNIX, on the other hand, was a relatively mature operating system at the time
when the PC was introduced. As a result, Microsoft-based environments have had
little influence on the development of UNIX. UNIX development was determined by
other factors: changes in legal regulations in the USA between 1977 and 1984
enabled AT&T first to license UNIX to other vendors, noticably Microsoft, who
announced XENIX in 1981, and then to market it itself. AT&T developed System
III in 1982, and System V in 1983. The differences between XENIX and System V
were initially small, but they grew: by the mid-80s, there were four different
versions of UNIX: the Research Version, used only inside AT&T, the
Berkeley Software Distribution (BSD) from Berkeley, the commercial
System V from AT&T, and XENIX, which no longer interested Microsoft, and
was marketed by the company which had developed it, the Santa Cruz
Operation, or SCO.
USLUNIXSystems
BerkeleySoftware Design
BSDI
One casualty of UNIX's maturity was the CSRG in Berkeley. UNIX was too mature
to be considered an object of research, and the writing was on the wall: the
CSRG would close down. Some people decided to port Berkeley UNIX to the
PC—after all, SCO had done it years ago. In the Berkeley tradition, however,
they wanted to give it away. The industry's reaction was not friendly. In
1992, AT&T's subsidiary USL (UNIX Systems Laboratories) filed a
lawsuit against Berkeley Software Design Inc. (BSDI), the
manufacturer of the BSD/386 and (later) the BSD/OS operating systems, both very
similar to FreeBSD, for alleged distribution of AT&T source code in violation of
licence agreements. They subsequently extended the case to the University of
California at Berkeley. The suit was settled out of court, and the exact
conditions were not all disclosed. The only one that became public was that
BSDI would migrate their source base to the newer 4.4BSD-Lite sources, a thing
that they were preparing to do in any case. Although not involved in the
litigation, it was suggested to FreeBSD that they should also move to
4.4BSD-Lite, which was done with the release of FreeBSD version 2.0 in late
1994.
Now, in the late 1990s, FreeBSD is the best-known of the BSD operating systems,
one that many consider to follow in the tradition of the CSRG. I can think of
no greater honour for the development team. It was developed on a shoestring
budget, yet it manages to outperform commercial operating systems by an order of
magnitude.
Things have changed elsewhere as well. In 1992, AT&T sold USL to Novell Inc.,
who had introduced a product based on System V.4 called UnixWare. Although
UnixWare has much better specifications than SCO's old System V.3 UNIX, it was
never a success, and Novell finally sold their UNIX operation to SCO, who now
markets both systems. Most FreeBSD users don't see that either system has any
significant advantage over FreeBSD, especially since FreeBSD can run
applications designed for either SCO system.
Other free UNIX-like operating systems
FreeBSD isn't the only free UNIX-like operating system available—it's not
even the best-known one. The best-known free UNIX-like operating system is
undoubtedly Linux, but there are also a number of other BSD-derived operating
systems. We'll look at them first:
386/BSD386/BSD was the original free BSD operating system, introduced by
William F. Jolitz in 1992. It never progressed beyond a test stage: instead,
two derivative operating systems arose, FreeBSD and NetBSD. As far as anybody
can tell, 386/BSD is dead.
NetBSDNetBSD is an operating system which, to the casual observer, is almost
identical to FreeBSD. The main differences are in the fact that NetBSD runs on
just about any hardware, whereas FreeBSD concentrates on mainly Intel hardware.
FreeBSD tries harder to be easy to understand for a beginner. For a comparison
of FreeBSD and NetBSD, somewhat biased towards NetBSD, and now also somewhat
dated, see http://www.cons.org/cracauer/bsd-net-vs-free.html.
OpenBSDOpenBSD is a spinoff of NetBSD which focuses on security. You can find
more information at http://www.openbsd.org.
You might get the impression that there are lots of different, incompatible BSD
versions. In fact, they're all very similar.
FreeBSD and LinuxLinux is a clone of UNIX written by Linus Torvalds, a student in Helsinki,
Finland. At the time, the BSD sources were not freely available, and so Linus
wrote his own version of UNIX.
Linux is a superb example of how a few dedicated, clever people can produce an
operating system that is better than well-known commercial systems developed by
a large number of trained software engineers. It is better even than a number
of commercial UNIX systems.
Obviously, I don't think Linux is as good as FreeBSD, or I wouldn't be writing
this book, but the differences between FreeBSD and Linux are more a matter of
philosophy rather than of concept. Here are a few contrasts:
Differences between FreeBSD and Linux
center,tab(#) ;
lw40 lw40 .
FreeBSD is a direct descendent of the original UNIX, though it contains no residual AT&T code. Linux is a clone and never contained any AT&T code
FreeBSD is a complete operating system, maintained by a central group of software developers. There is only one distribution of FreeBSD. Linux is a kernel, personally maintained by Linus Torvalds. The non-kernel programs supplied with Linux are part of a distribution, of which there are several.
FreeBSD aims to be a stable production environment. Linux is still a ``bleeding edge'' development environment, though many distributions aim to make it more suitable for production use.
As a result of the centralized development style, FreeBSD is straightforward and easy to install. The ease of installation of Linux depends on the ``distribution''. If you switch from one distribution of Linux to another, you'll have to learn a new set of installation tools.
FreeBSD is still relatively unknown, since its distribution was restricted for a long time due to the AT&T lawsuits. Linux did not have any lawsuits to contend with, so for a long time it was the only free UNIX-type system available.
As a result of the lack of knowledge of FreeBSD, not much commercial software is available for it. A growing amount of commercial software is becoming available for Linux.
As a result of the smaller user base, FreeBSD is less likely to have drivers for brand-new boards than Linux. Just about any new board will soon have a driver for Linux.
Because of the lack of commercial applications and drivers, FreeBSD will run most Linux programs, whether commercial or not. It's also relatively simple to port Linux drivers to FreeBSD. Linux appears not to need to be able to run FreeBSD programs or drivers.
FreeBSD has a large number of afficionados who are prepared to flame anybody who dares suggest that it's not better than Linux. Linux has a large number of afficionados who are prepared to flame anybody who dares suggest that it's not better than FreeBSD.
In summary, Linux is also a very good operating system. For many, it's better
than FreeBSD. It's a pity that so many people on both sides are prepared to
flame
To quote Eric Raymond's ``The New Hacker's Dictionary'':
:flame: 1. /vi./ To post an email message intended to insult and provoke.
2. /vi./ To speak incessantly and/or rabidly on some relatively uninteresting
subject or with a patently ridiculous attitude. 3. /vt./ Either of senses 1 or
2, directed with hostility at a particular person or people. 4. /n./ An
instance of flaming. When a discussion degenerates into useless controversy,
one might tell the participants ``Now you're just flaming'' or ``Stop all that
flamage!'' to try to get them to cool down (so to speak).
each other. There are signs that both sides are learning to appreciate each
other, and a number of people are now running both systems.
Other documentation on FreeBSD
People occasionally complain that there are so few books on
FreeBSD—currently, this is about the only one in the English language, and it
can't do everything. That looks like a pretty meagre offering, even if you do
like this book.
This impression is incorrect. In fact, FreeBSD users have access to probably
more top-quality documentation than just about any other operating system.
Remember that word UNIX\(rg. Sure, the lawyers tell us that we can't refer to
FreeBSD as UNIX, because UNIX belongs to the Open Group. That doesn't make the
slightest difference to the fact that just about any book on UNIX will apply
more directly to FreeBSD than any other flavour of UNIX. Why is this?
Commercial UNIX vendors have a problem, and FreeBSD doesn't help them: why
should people buy their products when you can get it free from the FreeBSD
Project (or, for that matter, from other free UNIX-like operating systems such
as NetBSD, OpenBSD and Linux)? One obvious reason would be ``value-added
features''. So they add features or fix weak points in the system, put a
copyright on the changes, and help lock their customers in to their particular
implementation. As long as the changes are really useful, this is legitimate,
but it does make the operating system less compatible with ``standard UNIX'',
and the books about standard UNIX are less applicable.
In addition, many books are written by people with an academic background. In
the UNIX world, this means that they are more likely than the average user to
have been exposed to BSD. Many general UNIX books handle primarily BSD,
possibly with an additional chapter on the commercial System V version.
In , you'll find a list of books which I find particularly worthwhile.
I'd like to single out some which I find particularly good, and which I
frequently use myself:
onlinehandbookhandbookonlineLiveFilesystem
The FreeBSD online handbook contains a lot of information specifically
about FreeBSD, including a deeper discussion of many topics in this book. It is
available on the World Wide Web at http://www.FreeBSD.org/handbook.html,
and it is also available on each FreeBSD system in the directory
/usr/share/doc/handbook. Before installation, you can access it from the
Live Filesystem CD-ROM. We'll look at how to do that in the next
section.
FAQFrequentlyAsked Questions/usr/share/doc/FAQVIEW
The FreeBSD FAQ (Frequently Asked Questions) is just what it
says it is: a list of questions that people frequently ask about FreeBSD, with
answers of course. It is located in the directory /usr/share/doc/FAQ. If
you run MS-DOS, you can view it before installation with the VIEW
program. Check the CD-ROM booklet for the location, which could change.
PeekJerryO'ReillyTimLoukidesMikeUNIX Power Tools, by Jerry Peek, Tim O'Reilly, and Mike Loukides, is a
superb collection of interesting information, including a CD-ROM. Recommended
for everybody, from beginners to experts.
AbrahamsPaul W.LarsonBruce R.UNIX for the Impatient, by Paul W. Abrahams and Bruce R. Larson, is more
similar to this book, but it includes a lot more material on specific products,
such as shells and the Emacs editor.
NemethEviSnyderGarthSeebassScottHeinTrent R.
The UNIX System Administration Handbook, by Evi Nemeth, Garth Snyder,
Scott Seebass, and Trent R. Hein, is one of the best books on systems
administration I have seen. It covers six different UNIX systems, including
BSD/OS, which is very close to FreeBSD.
There are a large number of active Internet groups which deal with FreeBSD.
Read about them in the online handbook.
Reading the handbooklynxcommand
If you're running X, you can use a browser like netscape to read the
handbook. If you don't have X running yet, use lynx. Both of these
programs are included on the CD-ROM. To install them, enter:
# pkg_add /cdrom/packages/All/netscape-communicator-4.5.tgzor
# pkg_add /cdrom/packages/All/lynx-2.8.1.1.tgzThe numbers after the name (4.5 and 2.8.1.1) may change after
this book has been printed. Use ls to list the names if you can't find
these particular versions.
Note that lynx is not a complete substitute for netscape: since
it is text-only, it is not capable of displaying the large majority of web pages
correctly. It will suffice for reading most of the handbook, however. See
page
pkg_addcommandcommandpkg_add
for more information on pkg_add.
In either case, you start the browser with the name of the handbook:
$ lynx /usr/share/doc/handbook/handbook.html
$ netscape /usr/share/doc/handbook/handbook.html &You enter the & after the invocation of netscape to free up the
window in which you invoke it: netscape opens its own window.
You can look at the FAQ in the same way—just substitute the name
FAQ/freebsd-faq.html for handbook/handbook.html.
If you haven't installed the handbook, you can still access it from the Live
Filesystem CD-ROM. Assuming the CD-ROM is mounted on /cdrom, choose the
directory /cdrom/usr/share/doc/handbook/handbook.html.
ghostscriptcommandcommandghostscriptdvipscommandcommanddvips
Alternatively, you can print out the handbook. This is a little more difficult,
and of course you'll lose the hypertext references, but you may prefer it in
this form. To format the handbook for printing, you'll need a PostScript
printer or ghostscript. See page for more details of how
to print PostScript.
You can download handbook from
ftp://ftp.FreeBSD.ORG/pub/FreeBSD/doc/handbook.ps.gz. Use ftp
(page ) to transfer the document.
The online manualmancommandmanpagecommandman
The most comprehensive documentation on FreeBSD is in the form of man
pages. Nearly every program on the system comes with a short reference
manual explaining the basic operation and various arguments.
When online, you view the man pages with the command man. For example, to
learn more about the command ls, type:
$ man ls
LS(1) FreeBSD Reference Manual LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [-ACFLRTacdfiloqrstu1] [ file ... ]
DESCRIPTION
For each operand that names a file of a type other than directory, ls
displays its name as well as any requested, associated information. For
each operand that names a file of type directory, ls displays the names.
(etc)In this particular example, with the exception of the first line, the text in
constant width bold is not input, it's the way it appears on the screen.
The online manual is divided up into sections numbered:
User commands
System calls and error numbers
Functions in the C libraries
Device drivers
File formats
Games and other diversions
Miscellaneous information
System maintenance and operation commands
Kernel interface documentation
chmodcommandcommandchmod
In some cases, the same topic may appear in more than one section of the on-line
manual. For example, there is a user command chmod and a system call
chmod(). In this case, you can tell the man command which you want by
specifying the section number:
$ man 1 chmod chmod(1)chmod(2)
This will display the manual page for the user command chmod. References to a
particular section of the on-line manual are traditionally placed in parentheses
in written documentation. For example, chmod(1) refers to the user
command chmod, and chmod(2) means the system call.
aproposcommandcommandapropos
This is fine if you know the name of the command and forgot how to use it, but
what if you can't recall the command name? You can use man to search for
keywords in the command descriptions by using the -k option, or by
starting the program apropos:
$ man -k mail
$ apropos mail Both of these commands do the same thing: they show the names of the man pages
that have the keyword mail in their descriptions.
Alternatively, you may browse through /usr/bin and see all these file
names, but you don't have any idea what they do. To find out, enter one of the
lines:
$ cd /usr/bin; man -f *
$ cd /usr/bin; whatis * Both of these commands do the same thing: they print out a one-line summary of
the purpose of the program:
$ cd /usr/bin; man -f *
a2p(1) - Awk to Perl translator
addftinfo(1) - add information to troff font files for use with groff
apply(1) - apply a command to a set of arguments
apropos(1) - search the whatis database for strings
\&...etcGNU infoinfocommandcommandinfoemacscommandcommandemacs
The Free Software Foundation has its own on-line hypertext browser called
info. Many FSF programs come with either no man page at all, or with an
excuse for a man page (gcc, for example). To read the online
documentation, you need to browse the info files with the info
program, or from Emacs with the info mode. To start info,
simply type:
$ info In Emacs, enter CTRL-h i or ALT-Xinfo. Whichever way
you start info, you can get brief introduction by typing h, and a
quick command reference by typing ?.
The FreeBSD community
FreeBSD was developed by a world-wide group of developers. It could not have
happened without the Internet. Most of the key players have never even met each
other in person: the main communication is via the Net. If you have any kind of
Internet connection, you can participate as well. If you don't have an Internet
connection, it's about time you got one. The connection doesn't have to be
complete: if you can receive email, you can participate. On the other hand,
FreeBSD includes all the software you need for a complete Internet connection,
not the very limited subset that most PC-based ``Internet'' packages offer you.
SupportSupportInstallationsupport
As it says in the copyright, FreeBSD is supplied as-is, without any support
liability. If you're on the Net, you're not alone, however. Liability is one
thing, but there are plenty of people prepared to help you, most for free, some
for fee. A good place to start is with the mailing lists
FreeBSD-newbies@FreeBSD.org and freebsd-questions@FreeBSD.org.
In conversation they are typically abbreviated to -newbies and
-questions respectively.
To sign up, send a mail message to majordomo@FreeBSD.org with the text
subscribe FreeBSD-newbies
or
subscribe FreeBSD-questions
You'll get a reply back saying that the request must be authenticated: it'll
look something like this:
Please be sure to read the charters before subscribing or sending
mail to any FreeBSD mailing list for an explanation of which topics
are relevant for a given list and what types of postings are and
are not allowed. They may be found at:
http://www.freebsd.org/handbook/eresources.html#ERESOURCES-MAIL
Someone (possibly you) has requested that your email address be added
to or deleted from the mailing list "freebsd-newbies@FreeBSD.ORG".
If you really want this action to be taken, please send the following
commands (exactly as shown) back to "Majordomo@FreeBSD.ORG":
auth 7e06ee31 subscribe freebsd-newbies grog@example.org
If you do not want this action to be taken, simply ignore this message
and the request will be disregarded.
If your mailer will not allow you to send the entire command as a single
line, you may split it using backslashes, like so:
auth 7e06ee31 subscribe freebsd-newbies \e
grog@example.org
If you have any questions about the policy of the list owner, please
contact "freebsd-newbies-approval@FreeBSD.ORG".
Thanks!
Majordomo@FreeBSD.ORG
Just reply to that message, removing all the text except the auth line:
auth 7e06ee31 subscribe freebsd-newbies grog@example.org
Send this message to majordomo@FreeBSD.org (which is what you do if you
just reply), not to the list itself. You'll get another reply back:
Welcome to the freebsd-newbies mailing list!
Please save this message for future reference. Thank you.
If you ever want to remove yourself from this mailing list,
you can send mail to <Majordomo@FreeBSD.ORG> with the following
command in the body of your email message:
unsubscribe freebsd-newbies
or from another account, besides grog@example.org:
unsubscribe freebsd-newbies grog@example.org
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-freebsd-newbies@FreeBSD.ORG> .
This is the general rule for most mailing lists when you need
to contact a human.
Here's the general information for the list you've subscribed to,
in case you don't already have it:
FREEBSD-NEWBIES
Welcome to FreeBSD!
This list is a gathering place for people new to FreeBSD.
Please feel free to share your experiences with others on this list.
Support questions should be sent to freebsd-questions@freebsd.org
(NOT to the newbies list please)
Full info and FAK http://www.welearn.com.au/freebsd/newbies/
Resource list http://www.FreeBSD.org/projects/newbies.html
As the welcome message says, -newbies is a discussion group for people
new to FreeBSD; it's not intended for real technical problems. Use
-questions for that.
When submitting questions to -questions, remember that people are under
no obligation to answer your question. Make them want to answer it: submit the
question in a clear, understandable manner. For more details, see
http://www.lemis.com/questions.html. You may also like to check out the
FreeBSD World Wide Web (WWW) site at http://www.FreeBSD.org, in particular
the support page at http://www.FreeBSD.org/support.html.
In addition, Walnut Creek CDROM supplies limited basic installation support for
purchasers of the Walnut Creek CDROM edition of FreeBSD. Here's how to contact
Walnut Creek CDROM:
By phone. Call +1 925 603 1234
If you live in North America, you may not recognize the +1. This is the
international dialing code for North America; replace the + symbol with
your national prefix code for international calls. For example, in most parts
of Europe you replace the + with 00; in Australia, you replace
it with 0011, so the complete number becomes 0011 1 925 603
1234.
By fax. Fax to +1 925 674 0821.
By email. Send email to support@cdrom.com.
Remember, too, that if all else fails you can return your CD-ROM to Walnut Creek
CDROM for an unconditional refund. If you do have to go to this step, please
let us know what went wrong. You'll get your refund either way, but if you have
problems with FreeBSD, we want to know why and how we can improve the product.
Reporting bugsIf you find something wrong with FreeBSD, we want to know about it. There are
two ways to report a bug:
Report it via the World Wide Web at http://www.FreeBSD.org/send-pr.html.
Use the send-pr program to send it as a mail message.
The Berkeley dægmonBranaganLindaBerkeleydægmondægmonBerkeleydaemonBerkeleyKolstadRobMcKusickKirk
The little dægmon on the cover of this book symbolizes BSD. It is included
with kind permission of Marshall Kirk McKusick, one of the leading members of
the former Computer Sciences Research Group at the University of California at
Berkeley, and owner of the dægmon's copyright.
The dægmon has occasionally given rise to a certain amount of confusion. In
fact, it's a joking reference to processes which run in the background—see
, page
for a description. The outside world occasionally sees things differently, as
the following story indicates:
Newsgroups: alt.humor.best-of-usenet
Subject: [comp.org.usenix] A Great Daemon Story
From: Rob Kolstad <kolstad@bsdi.com>
Newsgroups: comp.org.usenix
Subject: A Great Daemon Story
Linda Branagan is an expert on dægmons. She has a T-shirt that sports the
dægmon in tennis shoes that appears on the cover of the 4.3BSD manuals and
The Design and Implementation of the 4.3BSD UNIX Operating System by
S. Leffler, M. McKusick, M. Karels, J. Quarterman, Addison-Wesley Publishing
Company, Reading, MA 1989.
She tells the following story about wearing the 4.3BSD dægmon T-shirt:
Last week I walked into a local ``home style cookin' restaurant/watering hole''
in Texas to pick up a take-out order. I spoke briefly to the waitress behind
the counter, who told me my order would be done in a few minutes.
So, while I was busy gazing at the farm implements hanging on the walls, I was
approached by two ``natives.'' These guys might just be the original Texas
rednecks.
``Pardon us, ma'am. Mind if we ask you a question?''
Well, people keep telling me that Texans are real friendly, so I nodded.
``Are you a Satanist?''
Well, at least they didn't ask me if I liked to party.
``Uh, no, I can't say that I am.''
``Gee, ma'am. Are you sure about that?'' they asked.
I put on my biggest, brightest Dallas Cowboys cheerleader smile and said, ``No,
I'm positive. The closest I've ever come to Satanism is watching Geraldo.''
``Hmmm. Interesting. See, we was just wondering why it is you have the lord of
darkness on your chest there.''
I was this close to slapping one of them and causing a scene—then I stopped
and noticed the shirt I happened to be wearing that day. Sure enough, it had a
picture of a small, devilish-looking creature that has for some time now been
associated with a certain operating system. In this particular representation,
the creature was wearing sneakers.
They continued: ``See, ma'am, we don't exactly appreciate it when people show
off pictures of the devil. Especially when he's lookin' so friendly.''
These idiots sounded terrifyingly serious.
Me: ``Oh, well, see, this isn't really the devil, it's just, well, it's
sort of a mascot.
Native: ``And what kind of football team has the devil as a mascot?''
Me: ``Oh, it's not a team. It's an operating—uh, a kind of computer.''
I figured that an ATM machine was about as much technology as these guys could
handle, and I knew that if I so much as uttered the word ``UNIX'' I would only
make things worse.
Native: ``Where does this satanical computer come from?''
Me: ``California. And there's nothing satanical about it really.''
Somewhere along the line here, the waitress noticed my predicament—but these
guys probably outweighed her by 600 pounds, so all she did was look at me
sympathetically and run off into the kitchen.
Native: ``Ma'am, I think you're lying. And we'd appreciate it if you'd
leave the premises now.''
Fortunately, the waitress returned that very instant with my order, and they
agreed that it would be okay for me to actually pay for my food before I left.
While I was at the cash register, they amused themselves by talking to each
other.
Native #1: ``Do you think the police know about these devil computers?''
Native #2: ``If they come from California, then the FBI oughta know
about 'em.''
They escorted me to the door. I tried one last time: ``You're really blowing
this all out of proportion. A lot of people use this `kind of computers.'
Universities, researchers, businesses. They're actually very useful.''
Big, big, big mistake. I should have guessed at what came next.
Native: ``Does the government use these devil computers?''
Me: ``Yes.''
Another big boo-boo.
Native: ``And does the government pay for 'em? With our tax dollars?''
I decided that it was time to jump ship.
Me: ``No. Nope. Not at all. Your tax dollars never entered the picture at
all. I promise. No sir, not a penny. Our good Christian congressmen would
never let something like that happen. Nope. Never. Bye.''
Texas. What a country.
In fact, the dægmon tradition goes back quite a way. As recently as 1996, the
following message went through the FreeBSD-chat mailing list:
To: "Jonathan M. Bresler" <jmb@freefall.freebsd.org>
Cc: obrien@antares.aero.org (Mike O'Brien),
joerg_wunsch@uriah.heep.sax.de,
chat@FreeBSD.org, juphoff@tarsier.cv.nrao.edu
Date: Tue, 07 May 1996 16:27:20 -0700
Sender: owner-chat@FreeBSD.org
> details and gifs PLEASE!
If you insist. :-)SalusPeterFerentzMel
Sherman, set the Wayback Machine for around 1976 or so (see Peter Salus'
A Quarter Century of UNIX for details), when the first really national
UNIX meeting was held in Urbana, Illinois. This would be after the ``forty
people in a Brooklyn classroom'' meeting held by Mel Ferentz (yeah I was at that
too) and the more-or-less simultaneous West Coast meeting(s) hosted by SRI, but
before the UNIX Users Group was really incorporated as a going concern.
ThompsonKenRitchieDennisFoglioPhilO'BrienMike
I knew Ken Thompson and Dennis Ritchie would be there. I was living in
Chicago at the time, and so was comic artist Phil Foglio, whose star was just
beginning to rise. At that time I was a bonded locksmith. Phil's roommate had
unexpectedly split town, and he was the only one who knew the combination to the
wall safe in their apartment. This is the only apartment I've ever seen that
had a wall safe, but it sure did have one, and Phil had some stuff locked in
there. I didn't hold out much hope, since safes are far beyond where I was (and
am) in my locksmithing sphere of competence, but I figured ``no guts no glory''
and told him I'd give it a whack. In return, I told him, he could do some
T-shirt art for me. He readily agreed.
Wonder of wonders, this safe was vulnerable to the same algorithm that
Master locks used to be susceptible to. I opened it in about 15 minutes of
manipulation. It was my greatest moment as a locksmith and Phil was overjoyed.
I went down to my lab and shot some Polaroid snaps of the PDP-11 system I was
running UNIX on at the time, and gave it to Phil with some descriptions of the
visual puns I wanted: pipes, demons with forks running along the pipes, a ``bit
bucket'' named /dev/null, all that.
What Phil came up with is the artwork that graced the first decade's
worth of ``UNIX T-shirts'', which were made by a Ma and Pa operation in a
Chicago suburb. They turned out transfer art using a 3M color copier in their
basement. Hence, the PDP-11 is reversed (the tape drives are backwards) but
since Phil left off the front panel, this was hard to tell. His trademark
signature was photo-reversed, but was recopied by the T-shirt people and
``re-forwardized'', which is why it looks a little funny compared to his real
signature.
Dozens and dozens of these shirts were produced. Bell Labs alone
accounted for an order of something like 200 for a big picnic. However, only
four (4) REAL originals were produced: these have a distinctive red collar and
sleeve cuff. One went to Ken, one to Dennis, one to me, and one to my
then-wife. I now possess the latter two shirts. Ken and Dennis were presented
with their shirts at the Urbana conference.
StettnerArmando
People ordered these shirts direct from the Chicago couple. Many years
later, when I was living in LA, I got a call from Armando Stettner, then at DEC,
asking about that now-famous artwork. I told him I hadn't talked to the
Illinois T-shirt makers in years. At his request I called them up. They'd
folded the operation years ago and were within days of discarding all the old
artwork. I requested its return, and duly received it back in the mail. It
looked strange, seeing it again in its original form, a mirror image of the
shirts with which I and everyone else were now familiar.
I sent the artwork to Armando, who wanted to give it to the Ultrix
marketing people. They came out with the Ultrix poster that showed a nice shiny
Ultrix machine contrasted with the chewing-gum-and-string PDP-11 UNIX people
were familiar with. They still have the artwork, so far as I know.
I no longer recall the exact contents of the letter I sent along with
the artwork. I did say that as far as I knew, Phil had no residual rights to the
art, since it was a `work made for hire', though nothing was in writing (and
note this was decades before the new copyright law). I do not now recall if I
explicitly assigned all rights to DEC. What is certain is that John Lassiter's
dægmon, whether knowingly borrowed from the original, or created by parallel
evolution, postdates the first horde of UNIX dægmons by at least a decade and
probably more. And if Lassiter's dægmon looks a lot like a Phil Foglio
creation, there's a reason.
I have never scanned in Phil's artwork; I've hardly ever scanned in
anything, so I have no GIFs to show. But I have some very very old UNIX
T-shirts in startlingly good condition. Better condition than I am at any rate:
I no longer fit into either of them.
Mike O'Brien
creaky antique
Note the date of this message: it's quite recent. Mike has since scanned the
original teeshirt, and it may be made available. Remember, you read it here
first.
Before you installFreeBSD will run on just about any modern PC. You can skip this chapter and
move to , and you'll have a very good chance of success.
Nevertheless, it will make things easier if you know the contents of this
chapter before you start. If you do run into trouble, this chapter will give
you the background information you need to solve the trouble quickly and simply.
Hardware requirements
To run FreeBSD, you will need the following absolute minimum hardware:
PC with 80386 CPU, or Alpha-based machine with SRM firmware.
4 MB memory (Intel) or 24 MB (Alpha?)
Any display board
80 MB free disk space (Intel). Nobody has tried an installation on an Alpha
machine with less than 500 MB, though it's certainly possible to reduce this
value significantly.
Absolute minimum hardware for FreeBSDWhen I say absolute minimum, I mean it. You can run FreeBSD in
4 MB memory, but you will require at least 5 MB in order to install it. You
can't do very much with such a minimal system, but for some purposes it might be
adequate. For any kind of reasonable response time, you should use at least 8
MB of memory. Before you go to the trouble to even try such a minimal
installation, consider the cost of another 4 MB of memory. And you can pick up
better machines than this second-hand for $50. Is the hassle worth it?
To get full benefits from FreeBSD, you should be running the X Window system.
This uses more memory. Consider 16 MB a usable minimum here, though thanks to
FreeBSD's virtual memory system, this is not such a hard limit as it is with
some other systems.
The speed of a virtual memory based system such as FreeBSD depends at least as
much on memory performance as on processor performance. If you have, say, a
486DX-33 and 8 MB of memory, upgrading memory to 16 MB will probably buy you
more performance than upgrading the motherboard to a Pentium 100 and keeping the
8 MB memory. This applies for a usual mix of programs, in particular, programs
that don't perform number crunching.
Consider the following the minimum for getting useful work done with FreeBSD and
X:
PC with 80486DX/2-66, or Alpha-based machine
16 MB memory (i386) or 32 MB (Alpha).
SVGA display board with 2 MB memory, 1024x768
Mouse
200 MB free disk space
Recommended small FreeBSD and X11 systemYour mileage may vary. During the review phase of this book, one of the
reviewers pointed out that he was very happy with his machine, which has a
486-33 processor, 16 MB main memory, and 1 MB memory on his display board. He
says that it runs a lot faster than his Pentium 100 at work, which runs
Microsoft. If your hardware doesn't measure up to the recommended
specification, don't be discouraged: try it out anyway.
Beyond this minimum, FreeBSD supports a large number of other hardware
components. FreeBSD is a 32 bit operating system, and it cannot use the 16 bit
drivers commonly supplied with PC extension boards. If FreeBSD doesn't know
about the board, you probably won't be able to use it.
Compaq/Digital Alpha machinesProcessorAXPAXPProcessorProcessorAlphaAlphaarchitectureConsolefirmwareSRMConsole firmwareConsolefirmwareARCConsole firmware
Since version 3.0, FreeBSD supports computers based on the Compaq (previously
Digital) AXP processor, commonly called Alpha. FreeBSD requires
the same SRM console firmware as Digital UNIX. It will not work with
the ARC firmware used with Microsoft NT. The SRM firmware runs the machine in
64 bit mode, which is required to run FreeBSD, while the ARC firmware
sets 32 bit mode. If your system is currently running Digital UNIX, then you
should be able to use the existing SRM console. You can get firmware updates
from ftp://ftp.digital.com/pub/Digital/Alpha/firmware. The easiest way to
access it is via a web browser at
http://gatekeeper.dec.com/pub/Digital/Alpha/firmware/. Be careful to
transfer in binary mode.
Note that the SRM firmware is board-specific, so take care to choose the correct
file that matches your exact system: near enough is not good enough.
Unfortunately, some Alpha systems do not support the SRM firmware. You cannot
run FreeBSD on these systems.
The SRM console commands differ from one version to another. The commands
supported by your version are described in the hardware manual that was shipped
with your system. The console help command lists all supported console
commands. If your system has been set to boot automatically, you must type
Ctrl-C to interrupt the boot process and get to the SRM console prompt
(>>>). If the system is not set to boot automatically, it will display
the SRM console prompt after performing system checks.
All SRM console versions support the set and show commands which
operate on environment variables that are stored in non-volatile memory. The
show command lists all environment variables, including those that are
read-only.
Alpha's SRM is picky about which hardware it supports. For example, it
recognizes NCR SCSI boards, but it doesn't recognize Adaptec boards. There are
reports of some Alphas not booting with particular video boards. The
GENERIC kernel configuration (/usr/src/sys/alpha/conf/GENERIC)
shows what the kernel supports, but that doesn't mean that the SRM supports all
the devices. In addition, the SRM support varies from one machine to the next,
so there's a danger that what's described here won't work for you.
In the rest of this chapter, we'll look primarily at the i386 architecture.
Differences for Alpha include:
The disk layout for SRM is different from the layout for Microsoft. SRM looks
for its bootstrap where Microsoft keeps its partition table. This means that
you cannot share a disk between FreeBSD and Microsoft on an Alpha.
Most SRM-based Alpha machines don't support IDE drives, so you're limited to
SCSI.
LaptopslaptopHosokawaTatsumi
FreeBSD will also run on most laptops; the considerations above apply for
laptops as well. The generic kernel does not support all laptops optimally: if
you have a laptop, you should check Tatsumi Hosokawa's Mobile Computing page at
http://www.jp.FreeBSD.org/PAO/.
Driverskernel
driver
The generic FreeBSD kernel
kernel
The kernel is the core program of the operating system, and is resident in
memory at all times. To start the operating system, you load the kernel into
memory and run it.
contains support in the form of drivers for most common hardware, but
some less common drivers have been omitted. If you have a supported product
which is not in the generic kernel, you have two options:
You may be able to use a Kernel Loadable Module (kld). A kld is
a kernel component which can be loaded (and in some cases unloaded) while the
kernel is running.
If no kld exists for your product, you will need to build a special
kernel—we'll look at what this entails in .
/dev
Table shows the hardware which the i386 generic
kernel supports. New hardware support is being added all the time, so this
table can't be definitive. Look in the file /stand/help/hardware.hlp.gz,
from which this table was derived, or, even better, in the configuration file
/usr/src/sys/i386/conf/LINT or /usr/src/sys/alpha/conf/LINT for
authoritative information for your release of FreeBSD.
Hardware supported by FreeBSD
center,box,tab(#) ;
| lfCWp8 | cfCWp8 | cfCWp8 | cfCWp8 | cfCWp8 | lw45 | .
Device#Port#IRQ#DRQ#IOMem#Description
=
fdc03f062 Floppy disk controller wdc01f014 IDE/MFM/RLL disk controller wdc117015 IDE/MFM/RLL disk controller ncr0 NCR PCI SCSI controller bt0330\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 Buslogic SCSI controller uha0330\s+4\(bu\s06\s+4\(bu\s0 Ultrastore 14f aha0330\s+4\(bu\s05\s+4\(bu\s0 Adaptec 154x SCSI controller ahb0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 Adaptec 174x SCSI controller ahc0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 Adaptec 274x/284x/294x SCSI controller amd0 Tekram DC-390(T) / AMD 53c974 PCI SCSI aic034011\s+4\(bu\s0\s+4\(bu\s0 Adaptec 152x/AIC-6360 SCSI controller nca01f8810\s+4\(bu\s0\s+4\(bu\s0 ProAudioSpectrum cards sea0\s+4\(bu\s05\s+4\(bu\s0c8000 Seagate ST01/02 8 bit controller wt030051\s+4\(bu\s0 Wangtek and Archive QIC-02/QIC-36 mse023c5 Microsoft Bus Mouse psm06012 PS/2 Mouse (disabled by default) mcd030010 Mitsumi CD-ROM matcd0230 Matsushita/Panasonic CD-ROM scd0230 Sony CD-ROM sio03f84 Serial Port 0 (COM1) sio12f83 Serial Port 1 (COM2) lpt0\s+4\(bu\s07 Printer Port 0 lpt1\s+4\(bu\s0\s+4\(bu\s0 Printer Port 1 de0 DEC DC21x40 PCI based cards (including 21140 100bT cards) ed02805\s+4\(bu\s0d8000 WD & SMC 80xx; Novell NE1000 & NE2000; 3Com 3C503; HP PC Lan+ ed13005\s+4\(bu\s0d8000 Same as ed0 eg03105\s+4\(bu\s0\s+4\(bu\s0 3Com 3C505 ep030010\s+4\(bu\s0\s+4\(bu\s0 3Com 3C509 ex0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 Intel EtherExpress Pro/10 cards fe0300\s+4\(bu\s0 Allied-Telesis AT1700, RE2000 and Fujitsu FMV-180 series cards. fxp0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 Intel EtherExpress Pro/100B ie03607\s+4\(bu\s0d0000 AT&T StarLAN 10 and EN100; 3Com 3C507; NI5210 ix030010\s+4\(bu\s0d0000 Intel EtherExpress cards le03005\s+4\(bu\s0d0000 Digital Equipment EtherWorks 2 and EtherWorks 3 lnc028010\s+4\(bu\s0 Lance/PCnet cards (Isolan, Novell NE2100, NE32-VL) vx0\s+4\(bu\s0\s+4\(bu\s0\s+4\(bu\s0 3Com 3c59x / 3c9xx ze03005d8000 IBM/National Semiconductor PCMCIA Ethernet Controller zp030010d8000 3Com 3c589 Etherlink III PCMCIA Ethernet Controller
The device name in this table is the name by which the device is known to the
kernel. It usually corresponds to a name in the /dev directory, but
network interfaces such as Ethernet boards do not have device nodes. See
for some other exceptions.
If a field is marked with a bullet (\s+4\(bu\s0), the driver is capable
of determining the board settings by itself. If the field is empty, this board
does not use this particular feature at all. In addition to these controllers,
the source distribution contains drivers for a number of other controllers, as
shown in the following table. There are a number of reasons for not including
these drivers in the generic kernel: they may still be experimental, or they
take up too much space in the kernel, or they may conflict with other devices.
When configuring a driver for a kernel build, you need to specify the addresses,
so I have not included any information here. See the discussion of the
LINT configuration in , page
for further details.
Additional drivers supplied in source
center,box,tab(#) ;
| lfCWp9 | lw75 | .
\s10Driver name#Description
=
ctx Cortex-I frame grabber cx Cronyx/Sigma multiport sync/async cy Cyclades high-speed serial driver el 3Com 3C501 fea DEV DEFEA EISA FDDI adater fpa DEC DEFPA PCI FDDI adapter gp National Instruments AT-GPIB and AT-GPIB/TNT board gsc Genius GS-4500 hand scanner gus Gravis Ultrasound - Ultrasound, Ultrasound 16, Ultrasound MAX gusxvi Gravis Ultrasound 16-bit PCM joy Joystick labpc National Instrument's Lab-PC and Lab-PC+ meteor Matrox Meteor frame-grabber card mpu Roland MPU-401 stand-alone card mse Logitech & ATI InPort bus mouse ports mss Microsoft Sound System nic Dr Neuhaus NICCY 3008, 3009 & 5000 ISDN cards opl Yamaha OPL-2 and OPL-3 FM - SB, SB Pro, SB 16, ProAudioSpectrum pas ProAudioSpectrum PCM and MIDI pca PCM audio (/dev/audio) through your PC speaker psm PS/2 mouse port rc RISCom/8 multiport card sb SoundBlaster PCM - SoundBlaster, SB Pro, SB16, ProAudioSpectrum sbmidi SoundBlaster 16 MIDI interface sbxvi SoundBlaster 16 spigot Creative Labs Video Spigot video-acquisition board uart Stand-alone 6850 UART for MIDI wds Western Digital WD7000 IDE
Supported hardware—Alpha architectureAlphasupported hardware
FreeBSD/alpha supports the following alpha platforms:
UDB, Multia, AXPpci33, Noname
EB164, PC164, PC164LX, PC164SX
EB64+, Aspen Alpine, etc.
AlphaStation 200, 250, 255, 400
AlphaStation 500, 600
Digital Personal Workstation 433, 500, 600
DEC3000/300 family (netboot only)
DEC3000/[4-9]00 family (netboot only)
You need the SRM console firmware for your platform. In some cases, it is
possible to switch between AlphaBIOS (or ARC) firmware and SRM. In others it
will be necessary to download new firmware from
ftp.digital.com/pub/DEC/Alpha/firmwareYou need a dedicated disk for FreeBSD/alpha. Currently FreeBSD can't share a
disk with another operating system. This disk must be attached to a SCSI
controller which is supported by the SRM firmware (currently NCR or SYMBIOS and
Qlogic ISP).
The CD-ROM distributionInstallationCD-ROMCD-ROMInstallationLiveFile System CD-ROMCD-ROMLive File System
Walnut Creek CDROM distributes FreeBSD on four CD-ROMs:
The Installation Boot CD, packages, X11 CD-ROM. It contains everything
you need to install the system itself.
CD-ROMCVS RepositoryCVSRepository
The Live filesystem, CVS Repository, web pages CD-ROM.
The Packages/ports CD-ROM.
Docsand Extras
The Distribution tarballs and packages (overflow) CD-ROM.
All are mastered in ISO 9660 with Rock Ridge extensions (see page
for an explanation of these terms). We'll look at them in the following
sections.
CD-ROM 1: InstallationThe Installation CD-ROM contains everything you need to install FreeBSD on your
system. It supplies two categories of installable software:
System software is stored as gzipped tar archives in the
directories bin, catpages, compat1x, compat20,
compat21, des, dict, doc, games, info,
manpages and proflibs. To facilitate transport to and installation
from floppy, the archives have been divided into chunks of 240,640 bytes. For
example, the only required set is in the files bin/bin.aa to
bin/bin.cx.
packages/All
The directory packages/All contains ported, installable software
packages as gzipped tar archives. They are designed to be
installed directly on a running system, so they have not been divided into
chunks. Due to size restrictions on the CD-ROM, this directory does not contain
all the packages: some of them are on the fourth CD-ROM.
packages/All contains well over 1000 packages. To make it easier for you
to find your way around them, symbolic links to appropriate packages have been
placed in the directories archivers, astro, audio,
benchmarks, cad, chinese, comms, converters,
databases, devel, editors, emulators, games,
german, graphics, japanese, korean, lang,
mail, math, mbone, misc, net, news,
perl5, plan9, print, russian, security,
shells, sysutils, tcl75, tcl76, tcl80,
textproc, tk41, tk42, tk80, vietnamese and
www. Don't get the impression that these are different packages—they
are really pointers to the packages in All. You will find a list of the
currently available packages in the file /usr/ports/INDEX.
Table
lists the files in the main directory of the installation CD-ROM.
The installation CD-ROM
center,box,tab(#) ;
| lfI | lw64 | .
File#Contents
=
VIEW 00_index.txt A description of some of the files on the CD-ROM.
ABOUT.TXT A brief description of FreeBSD.
ERRATA.TXT A list of last-minute changes. Read this file. It can save you a lot of headaches.
HARDWARE.TXT A list of supported hardware.
INSTALL.TXT Information about installing FreeBSD.
LAYOUT.TXT A description of the CD-ROM layout.
README.TXT The traditional first file to read. It describes how to use the other files.
RELNOTES.TXT Release notes.
TRANS.TBL Translation table for Rock Ridge, of no interest to anybody else.
TROUBLE.TXT Information on what to do if you run into trouble.
UPGRADE.TXT Notes on upgrading from older versions of FreeBSD.
XF86333 Directory containing the XFree86 distribution. The release number may change in future releases of FreeBSD.
bin Installation directory: the binary distribution of the system. This is the only required directory for installation. See , for more detail.
book Information relating to this book, including the complete text in ASCII.
catpages Pre-formatted man pages. See page for more detail.
cdrom.cfg Machine-readable file describing the CD-ROM contents for the benefit of Microsoft programs.
cdrom.inf Machine-readable file describing the CD-ROM contents for the benefit of Microsoft programs.
commerce Commercial and shareware software for FreeBSD. Some of these packages are demos, others are supplied with restricted licenses. Read the file README in each subdirectory for more information.
compat1x Directory containing libraries to maintain compatibility with version 1.X of FreeBSD.
compat20 Directory containing libraries to maintain compatibility with version 2.0 of FreeBSD.
compat21 Directory containing libraries to maintain compatibility with version 2.1 of FreeBSD.
des Encryption software. Until recently, this software could be distributed only in the USA and Canada.
dict Installation directory: dictionaries.
doc Installation directory: documentation.
filename.txt A list of all the files on this CD-ROM.
floppies A directory containing installation floppy disk images.
games Installation directory: games.
info Installation directory: GNU info documents.
kernel The boot kernel.
makeflp.bat A Microsoft .BAT file for copying floppy images to floppy.
manpages A directory containing the man pages for installation.
packages A directory containing installable versions of the Ports Collection. See page .
ports The sources for the Ports Collection. See , page .
proflibs A directory containing profiled libraries, useful for identifying performance problems when programming.
setup.exe An Microsoft install program for installing from a running Microsoft system.
setup.hlp Help file for setup.exe.
src A directory containing the system source files.
tools A directory containing Microsoft tools to prepare for installation.
utils More Microsoft utilities.
view.exe An Microsoft based CD-ROM browser program. See page .
view.pif \&.PIF file for view.exe.
xperimnt A number of packages which are under development and were not ready for integration into FreeBSD at the time of release.
CD-ROM 2: Live File System, CVS Repository, web pagesLiveFile System CD-ROMCD-ROMLive File System
Although the installation CD-ROM contains everything you need to install
FreeBSD, the format isn't what you'd like to handle every day. The second
CD-ROM in the distribution, the Live File System CD-ROM, solves this
problem: it contains substantially the same data stored in file system format in
much the same way as you would install it on a hard disk. You can access the
files directly from this CD-ROM.
The second disk also contains the ``CVS Repository''. The repository is the
master source tree of all source code, including all update information. We'll
look at it in more detail in , page . This disk also
contains a snapshot of the Web pages at www.FreeBSD.org (directory
www).
CD-ROMs 3 and 4: The Ports CollectionPortsCollection
An important part of FreeBSD is the Ports Collection, which comprises over
2000 popular programs. The Ports Collection automates the process of porting
software to FreeBSD. A combination of various programming tools already
available in the base FreeBSD installation allows you to simply type
make for a given package. The ports mechanism does the rest, so you
need only enough disk space to build the ports you want.
PortsCollection
We'll look at the Ports Collection in more detail in Chapter .
The files are spread over 3 CD-ROMs:
You'll find the ports, the instructions for building the packages, on
CD-ROM 1.
The base sources for the Ports Collection fill more than one CD-ROM, even though
we were not able to include all sources due to copyright restrictions: some
source files are freely distributable on the net, but may not be distributed on
CD-ROM. Of the rest, most are on CD-ROM 3, with an overflow into CD-ROM 4.
Don't worry about the missing sources: if you're connected to the Internet, the
Ports Collection will automatically retrieve the sources from an Internet server
when you type make.
The packages, the precompiled binaries of the ports, are spread between
CD-ROM 1, which includes the most popular ones, and CD-ROM 4.
PC hardwareIn this section, we'll look at the information you need to understand in order
to install FreeBSD on the i386 architecture. In particular, we'll look at the
following topics:
How FreeBSD supports hardware, and what to do if your hardware doesn't
correspond to the system's expectations.
How FreeBSD and other PC operating systems handle disk space, and how to set up
your disk for FreeBSD, starting on page
How to share your disk with another operating system, starting on page
Some of this information also applies to the Alpha architecture. In particular,
though, an installation on an Alpha machine is a dedicated installation: you
can't share it with other operating systems.
How the system detects hardwareprobing
When the system starts, each driver in the kernel examines the system to find
any hardware which it might be able to control. This examination is called
probing. Depending on the driver, the probe may be clever enough to
recognize its hardware no matter how it has been set up, or it may expect the
hardware to be set up in a specific manner in order to find it. If the driver
only looks at specific settings, you have three possibilities:
You can set the board to match what the driver expects, typically by setting
jumpers or using a vendor supplied diagnostic program to set on-board
configuration memory.
UserConfig
You can use UserConfig to tell the addresses to the driver when booting
the system. UserConfig is a part of the kernel which allows interactive
modification of the system configuration at boot time—we'll look at it in more
detail in , on page
You can build a kernel to use the current board parameters.
There are four main parameters that you may need to set for PC controller
boards:
portaddress
The port address is the address of the first of possibly several control
registers which the driver uses to communicate with the board. It is normally
specified in hexadecimal, for example 0x320.
If you come from a Microsoft background, you might be more comfortable with the
notation 320H. The notation 0x320 comes from the C programming
language. You'll see a lot of it in UNIX.
Each board needs its own address or range of addresses. The ISA architecture
does not supply many addresses, and one of the most frequent causes of problems
when installing a board is that the port addresses overlap with those of another
board.
Beware of boards with a large number of registers. Typical port addresses end
in (hexadecimal) 0. Don't rely on being able to take any unoccupied
address ending in 0, though: some boards, such as Novell NE2000
compatible Ethernet boards, occupy up to 32 registers—in our example, from
0x320 to 0x33f. Note also that a number of addresses, such as
the serial and parallel ports, often end in 8.
interruptrequestsIRQ
Boards use an Interrupt Request, also referred to as IRQ, to get the
attention of the driver when a specific event happens. For example, when a
serial interface reads a character, it will generate an interrupt to tell the
driver to collect the character. Interrupt requests can sometimes be shared,
depending on the driver and the hardware. There are even fewer interrupt
requests than port addresses: a total of 15, of which a number are reserved by
the motherboard. You can usually expect to be able to use IRQs 3, 4, 5, 7, 9,
10, 11, 12, 14 and 15, though some motherboards use IRQ 15 for power saving
hardware. IRQ 2 is special: due to the design of the original IBM PC/AT, it is
the same thing as IRQ 9. FreeBSD refers to this interrupt as IRQ 9.
DirectMemory AccessDMADMARequestDMAAcknowledgeDMAChannel
Some high-speed devices perform Direct Memory Access, also known as
DMA, to transfer data to or from memory without CPU intervention. In
order to transfer data, they assert a DMA Request (DRQ) and wait for the
bus to reply with a DMA Acknowledge (DACK). The combination of DRQ and
DACK is sometimes called a DMA Channel. The ISA architecture supplies 7
DMA channels, numbered 0 to 3 (8 bit) and and 5 to 7 (16 bit). The floppy
driver uses DMA channel 2. DMA channels may not be shared.
memoryI/OI/OmemoryIOmem
Finally, controllers may have on-board memory which is usually located at
addresses between 0xa0000 and 0xeffff. This is sometimes
referred to as I/O memory or IOmem.
DisksIDEmodifiedfrequency modulationMFMRLLencodingrun length limitedrunlength limited encoding
A number of different disks are used on current PCs:
ST-506cablecontrolcabledatacontrolcabledatacableST-506 disks are the oldest. You can tell them by the fact that they
have two cables: a control cable which usually has connections for two
disks, and a thinner data cable which is not shared with any other disk.
They're just about completely obsolete by now, but FreeBSD still supports them
with the wd driver. These disks are sometimes called by their
modulation format, Modified Frequency Modulation or MFM. A
variant of MFM which offers about 50% more storage is RLL or Run
Length Limited modulation.
ESDIEnhancedSmall Device InterfaceATAttachmentATAESDI (Enhanced Small Device Interface) disks were designed to
work around some of the limitations of ST-506 drives. They also use the same
cabling as ST-506, but they are not hardware compatible, though most ESDI
controllers understand ST-506 commands. They are now also obsolete, but the
wd driver supports them, too.
IDEIntegratedDevice ElectronicsEIDEenhancedIDEIDE (Integrated Device Electronics), now frequently called
ATA (AT Attachment), is the current low-cost PC disk interface.
The disks (still a maximum of 2) are connected by a single 40-conductor flat
cable. From a software viewpoint, they are upwards compatible with the ST-506
drives. Most modern disks are so-called EIDE (Enhanced IDE)
drives. The original IDE disks are were limited by the BIOS standard to a size
of 504 MB (1024 * 16 * 63 * 512, or 528,482,304 bytes). EIDE drives exceed this
limit, but to do so they play funny games to hide the fact from Microsoft. FreeBSD
uses a new driver for all IDE disks.
programmedI/OPIO
A problem with older IDE controllers was that they used programmed I/O
or PIO to perform the transfer. In this mode, the CPU is directly
involved in the transfer to or from the disk. Older controllers transferred a
byte at a time, but more modern controllers can transfer in units of 32 bits.
Either way, disk transfers use a large amount of CPU time with programmed I/O,
and it's difficult to achieve the transfer rates of modern IDE drives, which can
be as high as 10 MB/s. During such transfers, the system appears to be
unbearably slow: it ``grinds to a halt''.
To solve this problem, modern chipsets offer DMA transfers, which almost
completely eliminate CPU overhead. FreeBSD supports DMA with most modern
chipsets. If your chipset supports DMA, you should enable it. See page
for details of how to do this.
Another factor influencing IDE performance is the fact that an IDE controller
can only perform one transfer at a time. If you have two disks on a controller,
and you want to access both, the controller serializes the requests so that a
request to one drive completes before the other started. This results in worse
performance than on a SCSI chain, which does not have this restriction. If you
have two disks and two controllers, it's better to put one disk on each
controller.
SCSISmallComputer Systems InterfacehostadapterwideSCSISCSI is the Small Computer Systems Interface. It is used for
disks, tapes, CD-ROMs and also other devices such as scanners and printers. The
SCSI controller is more correctly called a host adapter. SCSI devices are
connected by a single flat cable, usually with 50 conductors, which connects a
total of 8 devices, including at least one host adapter. A newer standard, Wide
SCSI, supports up to 16 devices and has a wider cable. Some SCSI devices have
subdevices, for example CD-ROM changers.
SCSI drives have a reputation for much higher performance than IDE. This is
mainly due to the fact that nearly all SCSI host adapters support DMA, whereas
in the past IDE controllers usually used programmed I/O. In addition, SCSI host
adapters can perform transfers from multiple units at the same time, whereas IDE
controllers can only perform one transfer at a time. Typical SCSI drives are
still faster than IDE drives, but the difference is nowhere near as large as it
used to be.
On the Alpha architecture, only SCSI drives are completely supported. It should
be possible to use IDE drives as well once the system is running, but you can't
boot from them.
Before you install FreeBSD, you need to decide how you want to use the disk
space available to you. If desired, FreeBSD will coexist with other operating
systems. In this section, we'll look at the way data is laid out on disk, and
what we need to do to create FreeBSD file systems on disk.
PC BIOS and disksread/writeheadheadread/write
The basics of disk drives are relatively straightforward: data is stored on one
or more rotating disks with a magnetic coating similar in function to the
coating on an audio tape. Unlike a tape, however, disk heads do not touch the
surface: the rotating disk produces an air pressure against the head which keeps
it floating very close to the surface. The disk transfers data to and from the
disk via (usually) one read/write head for each surface. People
frequently talk about the number of heads, not the number of surfaces, though
strictly speaking this is incorrect: if there are two heads per surface (to
speed up access), you're still interested in the number of surfaces, not the
number of heads.
tracksectorscylinder
While transferring data, the heads are stationary, so data is written on disks
in a number of circular tracks. Logically, each track is divided into a
number of sectors, which nowadays almost invariably contain 512 bytes.
A single positioning mechanism moves the heads from one track to another, so at
any one time all the tracks under the current head position can be accessed
without repositioning. This group of tracks is called a cylinder.
LogicalBlock AddressingLBACHS
To access older drives, such as ST-506 (MFM and RLL) drives, you needed to tell
the drive which cylinder, head and sector to address. This mode of addressing
is thus called CHS addressing. Even today, BIOS setup routines give you
the option of specifying information about disk drives in terms of the numbers
of cylinders, heads and sectors, and some insist on it. In fact, modern disk
drives no longer have a fixed number of sectors per track, and they address
blocks sequentially, so-called Logical Block Addressing or LBA.
CHS addressing has an additional problem: the ST-506 hardware definition allows
up to 1024 cylinders, 16 heads, and 63 sectors, which limits the addressibility
of the drive to 504 MB.
SCSI drives are a different matter: the BIOS doesn't know anything about them.
They are always addressed as a sequential list of sectors. It's up to the host
adapter (or, in the case of dumb host adapters such as the Seagate ST02, the
driver software) to interrogate the drive and find out how much space is on it.
Typically, the host adapter will have a BIOS which interrogates the drive and
finds its dimensions. The values it determines may not be correct: the
Microsoft 1 GB address limit (see page ) might bite you. Check
your controller documentation for details.
Logical and physical disk drivesdiskdrivesdiskdriveslogicaldisk drivesphysicaldisk drives
The PC world makes a distinction between logical disk drives and
physical disk drives. Physical disks are easy enough to understand, of
course, but the term logical drive needs some explanation. It refers to
a subdivision of a physical disk to which you can refer as if it were a disk by
itself.
partitionspartitiontable
Microsoft divides a disk into up to four partitions, headed by a partition
table. FreeBSD uses the term partition differently, as we will see,
so it refers to Microsoft's partitions as slices.
slicedefinedThis double usage of the word partition is really confusing. In this
book, I follow BSD usage, but I will continue to refer to the partition table by
that name.
Partitioning offers the flexibility that other operating systems need, so it has
been adopted by all operating systems that run on the PC platform. Figure
shows a disk with all four slices allocated.
h = .2i
dh = .02i
dw = 2i
boxht = .4i
move right 2.35i
down
[
[
boxwid = dw
M: box ht .15i "Master Boot Record"
P: box ht .15i "Partition Table"
A: box ht boxht
B: box ht boxht
C: box ht boxht
D: box ht boxht
"Partition (slice) 1" at A above
"/dev/da0s1" at A below
"Partition (slice) 2" at B above
"/dev/da0s2" at B below
"Partition (slice) 3" at C above
"/dev/da0s3" at C below
"Partition (slice) 4" at D above
"/dev/da0s4" at D below
]
]
Partition tablepartitiontablepartitionactive
The Partition Table is the most important data structure. It contains
information about the size, location and type of the slices (Microsoft partitions).
In Microsoft, one of these slices may be designated as active: at system
startup time, its bootstrap record will be used to start the system.
masterboot recordMBR
Although it is not as important as the partition table, the Master Boot
Record (MBR) is located at the very beginning of the disk to make
it easier for the system BIOS to find it at boot time. It contains code
necessary to find the correct slice from which to boot, so normally you need it
only on the first disk in the system. The MBR and the partition table take up
the first sector on disk.
MicrosoftpartitionprimaryMicrosoft partitionextendedMicrosoft partition
Microsoft designates one slice as the primary Microsoft partition, the
C: drive. Another slice may be designated as an extended Microsoft
partition, which contains the other ``drives'' (all together in one slice).
filesystemsswappartitionUNIXpartitionspartitionsUNIXda0devicedeviceda0
UNIX systems have their own form of partitioning, which predates Microsoft and is
not compatible with the Microsoft method. As a result, all versions of PC UNIX
which can coexist with Microsoft implement their own partitioning within a single
slice (Microsoft partition). BSD systems define up to 8 partitions per slice.
They can be used for the following purposes:
filesystem
A partition can be a file system, a structure in which UNIX stores files.
swappartition
It can be used as a swap partition. FreeBSD uses virtual memory: the
total addressed memory in the system can exceed the size of physical memory, so
we need space on disk to store memory pages which don't fit into physical
memory.
The partition may not be within the slice at all: it may refer to other parts of
the physical disk. In this case, it will probably overlap other partitions, and
you can't use it for file systems or swap space. For obvious reasons, the
partitions which represent file systems and swap space (a, b,
and d through h) should not overlap.
characterdevicedevicecharacter
In order to understand the naming, you need to understand how UNIX treats disks.
As we have seen, you can think of a disk as a large number of sequential blocks
of data. Looking at it like this doesn't give you a file system—it's more
like treating it as a tape. UNIX calls this kind of access raw access.
You'll also hear the term character device.
Normally, of course, you want files on your disk: you don't care where they are,
you just want to be able to open them and manipulate them. This involves a
whole lot more work than raw devices.
blockdevicedeviceblock
The standard term for disks is block device. You can recognize block
and character devices in an ls -l listing by the letters b and
c at the beginning of the permissions. For example:
$ ls -l /dev/rwd0s1a /dev/wd0s1a
crw-r----- 1 root operator 3, 131072 Oct 31 19:59 /dev/rwd0s1a
brw-r----- 1 root operator 0, 131072 Oct 31 19:59 /dev/wd0s1a
Let's look more carefully at how BSD names its partitions:
Like all other devices, the device entries are stored in the directory
/dev.
If the partition is raw (character), the name starts with the letter r.
If it isn't, there is no prefix.
Next comes the name of the driver. As we have seen, FreeBSD has drivers for IDE
and friends (wd), SCSI disks (da) and floppy disks (fd).
With our first SCSI disks, we now have the names /dev/rda and
/dev/da.
The abbreviation wd arose because the most popular of the original MFM
controllers were made by Western Digital. Others claim, however, that it's an
abbreviation for ``Winchester Disk''. The name da comes from the CAM
standard and is short for direct access.
Next comes the unit number, generally a single digit. For example, the first
SCSI disk on the system would normally be called /dev/da0.
Generally, the numbers are assigned during the boot probes, but you can reserve
numbers for SCSI disks if you want. This prevents the absence of a single disk
from changing the numbers of all subsequent drives. See page for
more details.
This gives us the names /dev/rda0 and /dev/da0.
slicenamestrictslice name
Next comes the partition information. The so-called strict slice name
is specified by adding the letter s (for slice) and the slice
number (1 to 4) to the disk name. BSD systems name partitions by appending the
letters a to h to the disk name. Thus, the first partition of
the first slice of our disk above (which would typically be a root file system)
would be called /dev/rda0s1a and /dev/da0s1a. Partition c
is an exception: by convention, it represents the whole BSD disk (in this case,
the slice in which FreeBSD resides).
compatibilityslice nameslicename
Other versions of BSD use a more relaxed terminology for the partition name:
they omit the slice information. Instead of calling the root file system
/dev/da0s1a, they refer to it as /dev/da0a. FreeBSD supports this
method as well—it's called compatibility slice naming, and it's the
form you'll see most frequently.
Table
gives you an overview of the devices which FreeBSD defines for a single physical
disk /dev/da0:
Disk partition terminology
center,box,tab(#) ;
| lfCWp9 | lw64 | .
\s10Slice name#Usage
=
/dev/rda0 Whole disk, raw access /dev/rda0s1 First slice (Microsoft ``partition''), raw access /dev/rda0s1a First slice (Microsoft ``partition''), partition a, raw access /dev/rda0s1b First slice (Microsoft ``partition''), partition b, raw access /dev/rda0s1d First slice (Microsoft ``partition''), partition d, raw access /dev/rda0s1e First slice (Microsoft ``partition''), partition e, raw access /dev/rda0s1f First slice (Microsoft ``partition''), partition f, raw access /dev/rda0s1g First slice (Microsoft ``partition''), partition g, raw access /dev/rda0s1h First slice (Microsoft ``partition''), partition h, raw access /dev/rda0s2 Second slice (Microsoft ``partition''), raw access /dev/rda0s3 Third slice (Microsoft ``partition''), raw access /dev/rda0s4 Fourth slice (Microsoft ``partition''), raw access /de