1 .\" $NetBSD: 6.t,v 1.4 2003/08/07 10:30:53 agc Exp $
3 .\" Copyright (c) 1980, 1986, 1988, 1993 The Regents of the University of California.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the University nor the names of its contributors
15 .\" may be used to endorse or promote products derived from this software
16 .\" without specific prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" @(#)6.t 8.2 (Berkeley) 6/1/94
32 .ds LH "Installing/Operating \*(4B
34 .Sh 1 "System operation"
36 This section describes procedures used to operate a \*(4B UNIX system.
37 Procedures described here are used periodically, to reboot the system,
38 analyze error messages from devices, do disk backups, monitor
39 system performance, recompile system software and control local changes.
40 .Sh 2 "Bootstrap and shutdown procedures"
42 In a normal reboot, the system checks the disks and comes up multi-user
43 without intervention at the console.
45 can be stopped (after it prints the date) with a ^C (interrupt).
46 This will leave the system in single-user mode, with only the console
48 (If the console has been marked ``insecure'' in
50 you must enter the root password to bring the machine to single-user mode.)
51 It is also possible to allow the filesystem checks to complete
52 and then to return to single-user mode by signaling
54 with a QUIT signal (^\|\e).
56 To bring the system up to a multi-user configuration from the single-user
58 all you have to do is hit ^D on the console. The system
61 a multi-user restart script (and
63 and come up on the terminals listed as
69 .Xr ttys (5) for more details.
70 Note, however, that this does not cause a filesystem check to be done.
71 Unless the system was taken down cleanly, you should run
72 ``fsck \-p'' or force a reboot with
74 to have the disks checked.
77 To take the system down to a single user state you can use
83 command (which is much more polite, if there are other users logged in)
84 when you are running multi-user.
85 Either command will kill all processes and give you a shell on the console,
86 as if you had just booted. Filesystems remain mounted after the
87 system is taken single-user. If you wish to come up multi-user again, you
91 \fB#\fP \fI/sbin/umount -a\fP
95 Each system shutdown, crash, processor halt and reboot
96 is recorded in the system log
98 .Sh 2 "Device errors and diagnostics"
100 When serious errors occur on peripherals or in the system, the system
101 prints a warning diagnostic on the console.
102 These messages are collected
103 by the system error logging process
105 and written into a system error log file
106 .Pn /var/log/messages .
107 Less serious errors are sent directly to
109 which may log them on the console.
110 The error priorities that are logged and the locations to which they are logged
112 .Pn /etc/syslog.conf .
117 Error messages printed by the devices in the system are described with the
118 drivers for the devices in section 4 of the programmer's manual.
119 If errors occur suggesting hardware problems, you should contact
120 your hardware support group or field service. It is a good idea to
121 examine the error log file regularly
122 (e.g. with the command \fItail \-r /var/log/messages\fP).
123 .Sh 2 "Filesystem checks, backups, and disaster recovery"
125 Periodically (say every week or so in the absence of any problems)
126 and always (usually automatically) after a crash,
127 all the filesystems should be checked for consistency
132 should be used to get the system to a state where a filesystem
133 check can be done manually or automatically.
135 Dumping of the filesystems should be done regularly,
136 since once the system is going it is easy to
138 Complete and incremental dumps are easily done with
140 You should arrange to do a towers-of-hanoi dump sequence; we tune
141 ours so that almost all files are dumped on two tapes and kept for at
142 least a week in most every case. We take full dumps every month (and keep
144 Operators can execute ``dump w'' at login that will tell them what needs
149 Be sure to create a group
153 so that dump can notify logged-in operators when it needs help.
155 More precisely, we have three sets of dump tapes: 10 daily tapes,
156 5 weekly sets of 2 tapes, and fresh sets of three tapes monthly.
157 We do daily dumps circularly on the daily tapes with sequence
158 `3 2 5 4 7 6 9 8 9 9 9 ...'.
159 Each weekly is a level 1 and the daily dump sequence level
160 restarts after each weekly dump.
161 Full dumps are level 0 and the daily sequence restarts after each full dump
164 Thus a typical dump sequence would be:
171 tape name level number date opr size
173 FULL 0 Nov 24, 1992 operator 137K
174 D1 3 Nov 28, 1992 operator 29K
175 D2 2 Nov 29, 1992 operator 34K
176 D3 5 Nov 30, 1992 operator 19K
177 D4 4 Dec 1, 1992 operator 22K
178 W1 1 Dec 2, 1992 operator 40K
179 D5 3 Dec 4, 1992 operator 15K
180 D6 2 Dec 5, 1992 operator 25K
181 D7 5 Dec 6, 1992 operator 15K
182 D8 4 Dec 7, 1992 operator 19K
183 W2 1 Dec 9, 1992 operator 118K
184 D9 3 Dec 11, 1992 operator 15K
185 D10 2 Dec 12, 1992 operator 26K
186 D1 5 Dec 15, 1992 operator 14K
187 W3 1 Dec 17, 1992 operator 71K
188 D2 3 Dec 18, 1992 operator 13K
189 FULL 0 Dec 22, 1992 operator 135K
191 We do weekly dumps often enough that daily dumps always fit on one tape.
193 Dumping of files by name is best done by
195 but the amount of data that can be moved in this way is limited
197 Finally if there are enough drives entire
198 disks can be copied with
200 using the raw special files and an appropriate
201 blocking factor; the number of sectors per track is usually
202 a good value to use, consult
205 It is desirable that full dumps of the root filesystem be
207 This is especially true when only one disk is available.
209 root filesystem is damaged by a hardware or software failure, you
210 can rebuild a workable disk doing a restore in the
211 same way that the initial root filesystem was created.
213 Exhaustion of user-file space is certain to occur
214 now and then; disk quotas may be imposed, or if you
215 prefer a less fascist approach, try using the programs
220 combined with threatening
221 messages of the day, and personal letters.
222 .Sh 2 "Moving filesystem data"
224 If you have the resources,
225 the best way to move a filesystem
226 is to dump it to a spare disk partition, or magtape, using
230 to create the new filesystem,
231 and restore the filesystem using
233 Filesystems may also be moved by piping the output of
239 program uses an ``in-place'' algorithm that
240 allows filesystem dumps to be restored without concern for the
241 original size of the filesystem. Further, portions of a
242 filesystem may be selectively restored using a method similar
243 to the tape archive program.
245 If you have to merge a filesystem into another, existing one,
246 the best bet is to use
248 If you must shrink a filesystem, the best bet is to dump
249 the original and restore it onto the new filesystem.
251 are playing with the root filesystem and only have one drive,
252 the procedure is more complicated.
253 If the only drive is a Winchester disk, this procedure may not be used
254 without overwriting the existing root or another partition.
255 What you do is the following:
257 GET A SECOND PACK, OR USE ANOTHER DISK DRIVE!!!!
259 Dump the root filesystem to tape using
262 Bring the system down.
264 Mount the new pack in the correct disk drive, if
265 using removable media.
267 Load the distribution tape and install the new
268 root filesystem as you did when first installing the system.
270 using the newly created disk filesystem.
272 Note that if you change the disk partition tables or add new disk
273 drivers they should also be added to the standalone system in
274 .Pn /sys/<architecture>/stand ,
275 and the default disk partition tables in
278 .Sh 2 "Monitoring system performance"
282 program provided with the system is designed to be an aid to monitoring
283 systemwide activity. The default ``pigs'' mode shows a dynamic ``ps''.
284 By running in the ``vmstat'' mode
285 when the system is active you can judge the system activity in several
286 dimensions: job distribution, virtual memory load, paging and swapping
287 activity, device interrupts, and disk and CPU utilization.
288 Ideally, there should be few blocked (b) jobs,
289 there should be little paging or swapping activity, there should
290 be available bandwidth on the disk devices (most single arms peak
291 out at 20-30 tps in practice), and the user CPU utilization (us) should
294 If the system is busy, then the count of active jobs may be large,
295 and several of these jobs may often be blocked (b). If the virtual
296 memory is active, then the paging demon will be running (sr will
297 be non-zero). It is healthy for the paging demon to free pages when
298 the virtual memory gets active; it is triggered by the amount of free
299 memory dropping below a threshold and increases its pace as free memory
302 If you run in the ``vmstat'' mode
303 when the system is busy, you can find
304 imbalances by noting abnormal job distributions. If many
305 processes are blocked (b), then the disk subsystem
306 is overloaded or imbalanced. If you have several non-DMA
307 devices or open teletype lines that are ``ringing'', or user programs
308 that are doing high-speed non-buffered input/output, then the system
309 time may go high (60-70% or higher).
310 It is often possible to pin down the cause of high system time by
311 looking to see if there is excessive context switching (cs), interrupt
312 activity (in) and per-device interrupt counts,
313 or system call activity (sy). Cumulatively on one of
314 our large machines we average about 60-200 context switches and interrupts
315 per second and about 50-500 system calls per second.
317 If the system is heavily loaded, or if you have little memory
318 for your load (2M is little in most any case), then the system
319 may be forced to swap. This is likely to be accompanied by a noticeable
320 reduction in system performance and pregnant pauses when interactive
321 jobs such as editors swap out.
322 If you expect to be in a memory-poor environment
323 for an extended period you might consider administratively
324 limiting system load.
325 .Sh 2 "Recompiling and reinstalling system software"
327 It is easy to regenerate either the entire system or a single utility,
328 and it is a good idea to try rebuilding pieces of the system to build
329 confidence in the procedures.
331 In general, there are six well-known targets supported by
332 all the makefiles on the system:
334 This entry is the default target, the same as if no target is specified.
335 This target builds the kernel, binary or library, as well as its
336 associated manual pages.
337 This target \fBdoes not\fP build the dependency files.
338 Some of the utilities require that a \fImake depend\fP be done before
339 a \fImake all\fP can succeed.
341 Build the include file dependency file, ``.depend'', which is
348 Install the kernel, binary or library, as well as its associated
354 Remove the kernel, binary or library, as well as any object files
355 created when building it.
357 The same as clean, except that the dependency files and formatted
358 manual pages are removed as well.
360 Build a shadow directory structure in the area referenced by
362 and create a symbolic link in the current source directory to
363 referenced it, named ``obj''.
364 Once this shadow structure has been created, all the files created by
366 will live in the shadow structure, and
368 may be mounted read-only by multiple machines.
369 Doing a \fImake obj\fP in
371 will build the shadow directory structure for everything on the
372 system except for the contributed, old, and kernel software.
374 The system consists of three major parts:
375 the kernel itself, found in
377 the libraries , found in
379 and the user programs (the rest of
382 Deprecated software, found in
384 often has old style makefiles;
385 some of it does not compile under \*(4B at all.
387 Contributed software, found in
388 .Pn /usr/src/contrib ,
389 usually does not support the ``cleandir'', ``depend'', or ``obj'' targets.
391 The kernel does not support the ``obj'' shadow structure.
392 All kernels are compiled in subdirectories of
393 .Pn /usr/src/sys/compile
394 which is usually abbreviated as
396 If you want to mount your source tree read-only,
397 .Pn /usr/src/sys/compile
398 will have to be on a separate filesystem from
402 can be done by making
403 .Pn /usr/src/sys/compile
404 a symbolic link that references
405 .Pn /usr/obj/sys/compile .
406 If it is a symbolic link, the \fIS\fP variable in the kernel
407 Makefile must be changed from
409 to the absolute pathname needed to locate the kernel sources, usually
411 The symbolic link created by
415 must also be manually changed to an absolute pathname.
417 .Pn /usr/src/sys/libkern/obj
418 directory must be located in
419 .Pn /usr/obj/sys/libkern .
421 Each of the standard utilities and libraries may be built and
422 installed by changing directories into the correct location and
426 \fB#\fP \fImake install\fP
428 Note, if system include files have changed between compiles,
430 will not do the correct dependency checks if the dependency
431 files have not been built using the ``depend'' target.
433 The entire library and utility suite for the system may be recompiled
434 from scratch by changing directory to
438 \fB#\fP \fImake build\fP
440 This target installs the system include files, cleans the source
441 tree, builds and installs the libraries, and builds and installs
442 the system utilities.
444 To recompile a specific program, first determine where the binary
447 command, then change to the corresponding source directory and build
448 it with the Makefile in the directory.
449 For instance, to recompile ``passwd'',
450 all one has to do is:
452 \fB#\fP \fIwhereis passwd\fP
453 \fB/usr/bin/passwd\fP
454 \fB#\fP \fIcd /usr/src/usr.bin/passwd\fP
456 \fB#\fP \fImake install\fP
458 this will compile and install the
462 If you wish to recompile and install all programs into a particular
463 target area you can override the default path prefix by doing:
466 \fB#\fP \fImake DESTDIR=\fPpathname \fIinstall\fP
468 Similarly, the mode, owner, group, and other characteristics of
469 the installed object can be modified by changing other default
473 .Pn /usr/src/share/mk/bsd.README ,
474 and the ``.mk'' scripts in the
476 directory for more information.
478 If you modify the C library or system include files, to change a
479 system call for example, and want to rebuild and install everything,
480 you have to be a little careful.
481 You must ensure that the include files are installed before anything
482 is compiled, and that the libraries are installed before the remainder
483 of the source, otherwise the loaded images will not contain the new
484 routine from the library.
485 If include files have been modified, the following commands should
488 \fB#\fP \fIcd /usr/src/include\fP
489 \fB#\fP \fImake install\fP
491 Then, if, for example, C library files have been modified, the
492 following commands should be executed:
495 \fB#\fP \fIcd /usr/src/lib/libc\fP
497 \fB#\fP \fImake depend\fP
501 \fB#\fP \fImake install\fP
504 \fB#\fP \fIcd /usr/src\fP
506 \fB#\fP \fImake depend\fP
510 \fB#\fP \fImake install\fP
514 Alternatively, the \fImake build\fP command described above will
515 accomplish the same tasks.
516 This takes several hours on a reasonably configured machine.
517 .Sh 2 "Making local modifications"
519 The source for locally written commands is normally stored in
521 and their binaries are kept in
523 This isolation of local binaries allows
527 to correspond to the distribution tape (and to the manuals that
529 People using local commands should be made aware that they are not
531 Manual pages for local commands should be installed in
532 .Pn /usr/local/man/cat[1-8].
535 command automatically finds manual pages placed in
536 /usr/local/man/cat[1-8] to encourage this practice (see
540 UNIX optionally records two kinds of accounting information:
541 connect time accounting and process resource accounting. The connect
542 time accounting information is stored in the file
544 which is summarized by the program
546 The process time accounting information is stored in the file
547 .Pn /var/account/acct
548 after it is enabled by
550 and is analyzed and summarized by the program
553 If you need to recharge for computing time, you can develop
554 procedures based on the information provided by these commands.
555 A convenient way to do this is to give commands to the clock daemon
557 to be executed every day at a specified time.
558 This is done by adding lines to
559 .Pn /etc/crontab.local ;
563 .Sh 2 "Resource control"
565 Resource control in the current version of UNIX is more
566 elaborate than in most UNIX systems. The disk quota
567 facilities developed at the University of Melbourne have
568 been incorporated in the system and allow control over the
569 number of files and amount of disk space each user and/or group may use
570 on each filesystem. In addition, the resources consumed
571 by any single process can be limited by the mechanisms of
573 As distributed, the latter mechanism
574 is voluntary, though sites may choose to modify the login
575 mechanism to impose limits not covered with disk quotas.
577 To use the disk quota facilities, the system must be
578 configured with ``options QUOTA''. Filesystems may then
579 be placed under the quota mechanism by creating a null file
583 at the root of the filesystem, running
587 to show that the filesystem is to run
588 with disk quotas (options userquota and/or groupquota).
591 program may then be run to enable quotas.
593 Individual quotas are applied by using the quota editor
595 Users may view their quotas (but not those of other users) with the
599 program may be used to summarize the quotas and current
600 space usage on a particular filesystem or filesystems.
602 Quotas are enforced with \fIsoft\fP and \fIhard\fP limits.
603 When a user and/or group first reaches a soft limit on a resource, a
604 message is generated on their terminal. If the user and/or group fails to
605 lower the resource usage below the soft limit
606 for longer than the time limit established for that filesystem
607 (default seven days) the system then treats the soft limit as a
608 \fIhard\fP limit and disallows any allocations until enough space is
609 reclaimed to bring the user and/or group back below the soft limit.
610 Hard limits are enforced strictly resulting in errors when a user
611 and/or group tries to create or write a file. Each time a hard limit is
612 exceeded the system will generate a message on the user's terminal.
614 Consult the auxiliary document, ``Disc Quotas in a UNIX Environment'' (SMM:4)
615 and the appropriate manual entries for more information.
616 .Sh 2 "Network troubleshooting"
618 If you have anything more than a trivial network configuration,
619 from time to time you are bound to run into problems. Before
620 blaming the software, first check your network connections. On
621 networks such as the Ethernet a
622 loose cable tap or misplaced power cable can result in severely
623 deteriorated service. The
625 program may be of aid in tracking down hardware malfunctions.
626 In particular, look at the \fB\-i\fP and \fB\-s\fP options in the manual page.
628 Should you believe a communication protocol problem exists,
629 consult the protocol specifications and attempt to isolate the
630 problem in a packet trace. The SO_DEBUG option may be supplied
631 before establishing a connection on a socket, in which case the
632 system will trace all traffic and internal actions (such as timers
633 expiring) in a circular trace buffer.
634 This buffer may then be printed out with the
637 Most of the servers distributed with the system
638 accept a \fB\-d\fP option forcing
639 all sockets to be created with debugging turned on.
640 Consult the appropriate manual pages for more information.
641 .Sh 2 "Files that need periodic attention"
643 We conclude the discussion of system operations by listing
644 the files that require periodic attention or are system specific:
648 /etc/fstab how disk partitions are used
649 /etc/disktab default disk partition sizes/labels
650 /etc/printcap printer database
651 /etc/gettytab terminal type definitions
652 /etc/remote names and phone numbers of remote machines for \fItip\fP(1)
653 /etc/group group memberships
654 /etc/motd message of the day
655 /etc/master.passwd password file; each account has a line
656 /etc/rc.local local system restart script; runs reboot; starts daemons
657 /etc/inetd.conf local internet servers
658 /etc/hosts local host name database
659 /etc/networks network name database
660 /etc/services network services database
661 /etc/hosts.equiv hosts under same administrative control
662 /etc/syslog.conf error log configuration for \fIsyslogd\fP\|(8)
663 /etc/ttys enables/disables ports
664 /etc/crontab commands that are run periodically
665 /etc/crontab.local local commands that are run periodically
666 /etc/aliases mail forwarding and distribution groups
667 /var/account/acct raw process account data
668 /var/log/messages system error log
669 /var/log/wtmp login session accounting