Merge branch 'vendor/BINUTILS225'
[dragonfly.git] / share / doc / smm / 01.setup / 2.t
1 .\" Copyright (c) 1988, 1993 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)2.t 8.1 (Berkeley) 7/27/93
29 .\" $FreeBSD: src/share/doc/smm/01.setup/2.t,v 1.7 1999/08/28 00:18:35 peter Exp $
30 .\" $DragonFly: src/share/doc/smm/01.setup/2.t,v 1.2 2003/06/17 04:36:57 dillon Exp $
31 .\"
32 .ds lq ``
33 .ds rq ''
34 .ds LH "Installing/Operating \*(4B
35 .ds RH Bootstrapping
36 .ds CF \*(Dy
37 .Sh 1 "Bootstrap procedure"
38 .PP
39 This section explains the bootstrap procedure that can be used
40 to get the kernel supplied with this distribution running on your machine.
41 If you are not currently running \*(Ps you will
42 have to do a full bootstrap.
43 Section 3 describes how to upgrade a \*(Ps system.
44 An understanding of the operations used in a full bootstrap
45 is helpful in doing an upgrade as well.
46 In either case, it is highly desirable to read and understand
47 the remainder of this document before proceeding.
48 .PP
49 The distribution supports a somewhat wider set of machines than
50 those for which we have built binaries.
51 The architectures that are supported only in source form include:
52 .IP \(bu
53 Intel 386/486-based machines (ISA/AT or EISA bus only)
54 .IP \(bu
55 Sony News MIPS-based workstations
56 .IP \(bu
57 Omron Luna 68000-based workstations
58 .LP
59 If you wish to run one of these architectures,
60 you will have to build a cross compilation environment.
61 Note that the distribution does
62 .B not
63 include the machine support for the Tahoe and VAX architectures
64 found in previous BSD distributions.
65 Our primary development environment is the HP9000/300 series machines.
66 The other architectures are developed and supported by
67 people outside the university.
68 Consequently, we are not able to directly test or maintain these 
69 other architectures, so cannot comment on their robustness,
70 reliability, or completeness.
71 .Sh 2 "Bootstrapping from the tape"
72 .LP
73 The set of files on the distribution tape are as follows:
74 .IP 1)
75 A
76 .Xr dd (1)
77 (HP300),
78 .Xr tar (1)
79 (DECstation), or
80 .Xr dump (8)
81 (SPARC) image of the root filesystem
82 .IP 2)
83 A
84 .Xr tar
85 image of the
86 .Pn /var
87 filesystem
88 .IP 3)
89 A
90 .Xr tar
91 image of the
92 .Pn /usr
93 filesystem
94 .IP 4)
95 A
96 .Xr tar
97 image of
98 .Pn /usr/src/sys
99 .IP 5)
100 A
101 .Xr tar
102 image of
103 .Pn /usr/src
104 except sys and contrib
105 .IP 6)
106 A
107 .Xr tar
108 image of
109 .Pn /usr/src/contrib
110 .IP 7)
111 (8mm Exabyte tape distributions only)
112 A
113 .Xr tar
114 image of
115 .Pn /usr/src/X11R5
116 .LP
117 The tape bootstrap procedure used to create a
118 working system involves the following major steps:
119 .IP 1)
120 Transfer a bootable root filesystem from the tape to a disk
121 and get it booted and running.
122 .IP 2)
123 Build and restore the
124 .Pn /var
125 and
126 .Pn /usr
127 filesystems from tape with
128 .Xr tar (1).
129 .IP 3)
130 Extract the system and utility source files as desired.
131 .PP
132 The following sections describe the above steps in detail.
133 The details of the first step vary between architectures.
134 The specific steps for the HP300, SPARC, and DECstation are
135 given in the next three sections respectively.
136 You should follow the instructions for your particular architecture.
137 In all sections,
138 commands you are expected to type are shown in italics, while that
139 information printed by the system is shown emboldened.
140 .Sh 2 "Booting the HP300"
141 .Sh 3 "Supported hardware"
142 .LP
143 The hardware supported by \*(4B for the HP300/400 is as follows:
144 .TS
145 center box;
146 lw(1i) lw(4i).
147 CPU's   T{
148 68020 based (318, 319, 320, 330 and 350),
149 68030 based (340, 345, 360, 370, 375, 400) and
150 68040 based (380, 425, 433).
151 T}
152 _
153 DISK's  T{
154 HP-IB/CS80 (7912, 7914, 7933, 7936, 7945, 7957, 7958, 7959, 2200, 2203)
155 and SCSI-I (including magneto-optical).
156 T}
157 _
158 TAPE's  T{
159 Low-density CS80 cartridge (7914, 7946, 9144),
160 high-density CS80 cartridge (9145),
161 HP SCSI DAT and
162 SCSI Exabyte.
163 T}
164 _
165 RS232   T{
166 98644 built-in single-port, 98642 4-port and 98638 8-port interfaces.
167 T}
168 _
169 NETWORK T{
170 98643 internal and external LAN cards.
171 T}
172 _
173 GRAPHICS        T{
174 Terminal emulation and raw frame buffer support for
175 98544 / 98545 / 98547 (Topcat color & monochrome),
176 98548 / 98549 / 98550 (Catseye color & monochrome),
177 98700 / 98710 (Gatorbox),
178 98720 / 98721 (Renaissance),
179 98730 / 98731 (DaVinci) and
180 A1096A (Hyperion monochrome).
181 T}
182 _
183 INPUT   T{
184 General interface supporting all HIL devices.
185 (e.g. keyboard, 2 and 3 button mice, ID module, ...)
186 T}
187 _
188 MISC    T{
189 Battery-backed real time clock,
190 builtin and 98625A/B HP-IB interfaces,
191 builtin and 98658A SCSI interfaces,
192 serial printers and plotters on HP-IB,
193 and SCSI autochanger device.
194 T}
195 .TE
196 .LP
197 Major items that are not supported
198 include the 310 and 332 CPU's, 400 series machines
199 configured for Domain/OS, EISA and VME bus adaptors, audio, the centronics
200 port, 1/2" tape drives (7980), CD-ROM, and the PVRX/TVRX 3D graphics displays.
201 .Sh 3 "Standalone device file naming"
202 .LP
203 The standalone system device name syntax on the HP300 is of the form:
204 .DS
205 xx(a,c,u,p)
206 .DE
207 where
208 \fIxx\fP is the device type,
209 \fIa\fP specifies the adaptor to use,
210 \fIc\fP the controller,
211 \fIu\fP the unit, and
212 \fIp\fP a partition.
213 The \fIdevice type\fP differentiates the various disks and tapes and is one of:
214 ``rd'' for HP-IB CS80 disks,
215 ``ct'' for HP-IB CS80 cartridge tapes, or
216 ``sd'' for SCSI-I disks
217 (SCSI-I tapes are currently not supported).
218 The \fIadaptor\fP field is a logical HP-IB or SCSI bus adaptor card number.
219 This will typically be
220 0 for SCSI disks,
221 0 for devices on the ``slow'' HP-IB interface (usually tapes) and
222 1 for devices on the ``fast'' HP-IB interface (usually disks).
223 To get a complete mapping of physical (select-code) to logical card numbers
224 just type a ^C at the standalone prompt.
225 The \fIcontroller\fP field is the disk or tape's target number on the
226 HP-IB or SCSI bus.
227 For SCSI the range is 0 to 6 (7 is the adaptor address) and
228 for HP-IB the range is 0 to 7.
229 The \fIunit\fP field is unused and should be 0.
230 The \fIpartition\fP field is interpreted differently for tapes
231 and disks: for disks it is a disk partition (in the range 0-7),
232 and for tapes it is a file number offset on the tape.
233 Thus, partition 2 of a SCSI disk drive at target 3 on SCSI bus 1
234 would be ``sd(1,3,0,2)''.
235 If you have only one of any type bus adaptor, you may omit the adaptor
236 and controller numbers;
237 e.g. ``sd(0,2)'' could be used instead of ``sd(0,0,0,2)''.
238 The following examples always use the full syntax for clarity.
239 .Sh 3 "The procedure"
240 .LP
241 The basic steps involved in bringing up the HP300 are as follows:
242 .IP 1)
243 Obtain a second disk and format it, if necessary.
244 .IP 2)
245 Copy a root filesystem from the
246 tape onto the beginning of the disk.
247 .IP 3)
248 Boot the UNIX system on the new disk.
249 .IP 4)
250 (Optional) Build a root filesystem optimized for your disk.
251 .IP 5)
252 Label the disks with the
253 .Xr disklabel (8)
254 program.
255 .Sh 4 "Step 1: selecting and formatting a disk"
256 .PP
257 For your first system you will have to obtain a formatted disk
258 of a type given in the ``supported hardware'' list above.
259 If you want to load an entire binary system
260 (i.e., everything except
261 .Pn /usr/src ),
262 on the single disk you will need a minimum of 290MB,
263 ruling out anything smaller than a 7959B/S disk.
264 The disklabel included in the bootstrap root image is laid out
265 to accommodate this scenario.
266 Note that an HP SCSI magneto-optical disk will work fine for this case.
267 \*(4B will boot and run (albeit slowly) using one.
268 If you want to load source on a single disk system,
269 you will need at least 640MB (at least a 2213A SCSI or 2203A HP-IB disk).
270 A disk as small as the 7945A (54MB) can be used for the bootstrap
271 procedure but will hold only the root and primary swap partitions.
272 If you plan to use multiple disks,
273 refer to section 2.5 for suggestions on partitioning.
274 .PP
275 After selecting a disk, you may need to format it.
276 Since most HP disk drives come pre-formatted
277 (except optical media)
278 you probably will not, but if necessary,
279 you can format a disk under HP-UX using the
280 .Xr mediainit (1m)
281 program.
282 Once you have \*(4B up and running on one machine you can use the
283 .Xr scsiformat (8)
284 program to format additional SCSI disks.
285 Any additional HP-IB disks will have to be formatted using HP-UX.
286 .Sh 4 "Step 2: copying the root filesystem from tape to disk"
287 .PP
288 Once you have a formatted second disk you can use the
289 .Xr dd (1)
290 command under HP-UX to copy the root filesystem image from
291 the tape to the beginning of the second disk.
292 For HP's, the root filesystem image is the first file on the tape.
293 It includes a disklabel and bootblock along with the root filesystem.
294 An example command to copy the image from tape to the beginning of a disk is:
295 .DS
296 .ft CW
297 dd if=/dev/rmt/0m of=/dev/rdsk/1s0 bs=\*(Bzb
298 .DE
299 The actual special file syntax may vary depending on unit numbers and
300 the version of HP-UX that is running.
301 Consult the HP-UX
302 .Xr mt (7)
303 and
304 .Xr disk (7)
305 man pages for details.
306 .PP
307 Note that if you have a SCSI disk, you don't necessarily have to use
308 HP-UX (or an HP) to create the boot disk.
309 Any machine and operating system that will allow you to copy the
310 raw disk image out to block 0 of the disk will do.
311 .PP
312 If you have only a single machine with a single disk,
313 you may still be able to install and boot \*(4B if you have an
314 HP-IB cartridge tape drive.
315 If so, you can use a more difficult approach of booting a
316 standalone copy program from the tape, and using that to copy the
317 root filesystem image from the tape to the disk.
318 To do this, you need to extract the first file of the distribution tape
319 (the root image), copy it over to a machine with a cartridge drive
320 and then copy the image onto tape.
321 For example:
322 .DS
323 .ft CW
324 dd if=/dev/rst0 of=bootimage bs=\*(Bzb
325 rcp bootimage foo:/tmp/bootimage
326 <login to foo>
327 dd if=/tmp/bootimage of=/dev/rct/0m bs=\*(Bzb
328 .DE
329 Once this tape is created you can boot and run the standalone tape
330 copy program from it.
331 The copy program is loaded just as any other program would be loaded
332 by the bootrom in ``attended'' mode:
333 reset the CPU,
334 hold down the space bar until the word ``Keyboard'' appears in the
335 installed interface list, and
336 enter the menu selection for SYS_TCOPY.
337 Once loaded and running:
338 .DS
339 .TS
340 lw(2i) l.
341 \fBFrom:\fP \fI^C\fP    (control-C to see logical adaptor assignments)
342 \fBhpib0 at sc7\fP
343 \fBscsi0 at sc14\fP
344 \fBFrom:\fP \fIct(0,7,0,0)\fP   (HP-IB tape, target 7, first tape file)
345 \fBTo:\fP \fIsd(0,0,0,2)\fP     (SCSI disk, target 0, third partition)
346 \fBCopy completed: 1728 records copied\fP
347 .TE
348 .DE
349 .LP
350 This copy will likely take 30 minutes or more.
351 .Sh 4 "Step 3: booting the root filesystem"
352 .PP
353 You now have a bootable root filesystem on the disk.
354 If you were previously running with two disks,
355 it would be best if you shut down the machine and turn off power on
356 the HP-UX drive.
357 It will be less confusing and it will eliminate any chance of accidentally
358 destroying the HP-UX disk.
359 If you used a cartridge tape for booting you should also unload the tape
360 at this point.
361 Whether you booted from tape or copied from disk you should now reboot
362 the machine and do another attended boot (see previous section),
363 this time with SYS_TBOOT.
364 Once loaded and running the boot program will display the CPU type and
365 prompt for a kernel file to boot:
366 .DS
367 .B
368 HP433 CPU
369 Boot
370 .R
371 \fB:\fP \fI/kernel\fP
372 .DE
373 .LP
374 After providing the kernel name, the machine will boot \*(4B with
375 output that looks about like this:
376 .DS
377 .B
378 597480+34120+139288 start 0xfe8019ec
379 Copyright (c) 1982, 1986, 1989, 1991, 1993
380         The Regents of the University of California.
381 Copyright (c) 1992 Hewlett-Packard Company
382 Copyright (c) 1992 Motorola Inc.
383 All rights reserved.
384
385 4.4BSD UNIX #1: Tue Jul 20 11:40:36 PDT 1993
386     mckusick@vangogh.CS.Berkeley.EDU:/usr/obj/sys/compile/GENERIC.hp300
387 HP9000/433 (33MHz MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches)
388 real mem = xxx
389 avail mem = ###
390 using ### buffers containing ### bytes of memory
391 (... information about available devices ...)
392 root device?
393 .R
394 .DE
395 .PP
396 The first three numbers are printed out by the bootstrap program and
397 are the sizes of different parts of the system (text, initialized and
398 uninitialized data).  The system also allocates several system data
399 structures after it starts running.  The sizes of these structures are
400 based on the amount of available memory and the maximum count of active
401 users expected, as declared in a system configuration description.  This
402 will be discussed later.
403 .PP
404 UNIX itself then runs for the first time and begins by printing out a banner
405 identifying the release and
406 version of the system that is in use and the date that it was compiled. 
407 .PP
408 Next the
409 .I mem
410 messages give the
411 amount of real (physical) memory and the
412 memory available to user programs
413 in bytes.
414 For example, if your machine has 16Mb bytes of memory, then
415 \fBxxx\fP will be 16777216.
416 .PP
417 The messages that come out next show what devices were found on
418 the current processor.  These messages are described in
419 .Xr autoconf (4).
420 The distributed system may not have
421 found all the communications devices you have
422 or all the mass storage peripherals you have, especially
423 if you have more than
424 two of anything.  You will correct this when you create
425 a description of your machine from which to configure a site-dependent
426 version of UNIX.
427 The messages printed at boot here contain much of the information
428 that will be used in creating the configuration.
429 In a correctly configured system most of the information
430 present in the configuration description
431 is printed out at boot time as the system verifies that each device
432 is present.
433 .PP
434 The \*(lqroot device?\*(rq prompt was printed by the system
435 to ask you for the name of the root filesystem to use.
436 This happens because the distribution system is a \fIgeneric\fP
437 system, i.e., it can be bootstrapped on a cpu with its root device
438 and paging area on any available disk drive.
439 You will most likely respond to the root device question with ``sd0''
440 if you are booting from a SCSI disk,
441 or with ``rd0'' if you are booting from an HP-IB disk.
442 This response shows that the disk it is running
443 on is drive 0 of type ``sd'' or ``rd'' respectively.
444 If you have other disks attached to the system,
445 it is possible that the drive you are using will not be configured
446 as logical drive 0.
447 Check the autoconfiguration messages printed out by the kernel to
448 make sure.
449 These messages will show the type of every logical drive
450 and their associated controller and slave addresses.
451 You will later build a system tailored to your configuration
452 that will not prompt you for a root device when it is bootstrapped.
453 .DS
454 \fBroot device?\fP \fI\*(Dk0\fP
455 \fBWARNING: preposterous time in filesystem \-\- CHECK AND RESET THE DATE!\fP
456 \fBerase ^?, kill ^U, intr ^C\fP
457 \fB#\fP
458 .DE
459 .PP
460 The \*(lqerase ...\*(rq message is part of the
461 .Pn /.profile
462 that was executed by the root shell when it started.  This message
463 tells you about the settings of the character erase,
464 line erase, and interrupt characters.
465 .PP
466 UNIX is now running,
467 and the \fIUNIX Programmer's Manual\fP applies.  The ``#'' is the prompt
468 from the Bourne shell, and lets you know that you are the super-user,
469 whose login name is \*(lqroot\*(rq.
470 .PP
471 At this point, the root filesystem is mounted read-only.
472 Before continuing the installation, the filesystem needs to be ``updated''
473 to allow writing and device special files for the following steps need
474 to be created.
475 This is done as follows:
476 .DS
477 .TS
478 lw(2i) l.
479 \fB#\fP \fImount_mfs -s 1000 -T type /dev/null /tmp\fP  (create a writable filesystem)
480 (\fItype\fP is the disk type as determined from /etc/disktab)
481 \fB#\fP \fIcd /tmp\fP   (connect to that directory)
482 \fB#\fP \fI../dev/MAKEDEV \*(Dk#\fP     (create special files for root disk)
483 (\fI\*(Dk\fP is the disk type, \fI#\fP is the unit number)
484 (ignore warning from ``sh'')
485 \fB#\fP \fImount \-uw /tmp/\*(Dk#a /\fP (read-write mount root filesystem)
486 \fB#\fP \fIcd /dev\fP   (go to device directory)
487 \fB#\fP \fI./MAKEDEV \*(Dk#\fP  (create permanent special files for root disk)
488 (again, ignore warning from ``sh'')
489 .TE
490 .DE
491 .Sh 4 "Step 4: (optional) restoring the root filesystem"
492 .PP
493 The root filesystem that you are currently running on is complete,
494 however it probably is not optimally laid out for the disk on
495 which you are running.
496 If you will be cloning copies of the system onto multiple disks for
497 other machines, you are advised to connect one of these disks to
498 this machine, and build and restore a properly laid out root filesystem
499 onto it.
500 If this is the only machine on which you will be running \*(4B
501 or peak performance is not an issue, you can skip this step and
502 proceed directly to step 5.
503 .PP
504 Connect a second disk to your machine.
505 If you bootstrapped using the two disk method, you can
506 overwrite your initial HP-UX disk, as it will no longer
507 be needed (assuming you have no plans to run HP-UX again).
508 .PP
509 To really create the root filesystem on drive 1
510 you should first label the disk as described in step 5 below.
511 Then run the following commands:
512 .DS
513 \fB#\fP \fIcd /dev\fP
514 \fB#\fP \fI./MAKEDEV \*(Dk1a\fP
515 \fB#\fP\|\fInewfs /dev/r\*(Dk1a\fP
516 \fB#\fP\|\fImount /dev/\*(Dk1a /mnt\fP
517 \fB#\fP\|\fIcd /mnt\fP
518 \fB#\fP\|\fIdump 0f \- /dev/r\*(Dk0a | restore xf \-\fP
519 (Note: restore will ask if you want to ``set owner/mode for '.'''
520 to which you should reply ``yes''.)
521 .DE
522 .PP
523 When this completes,
524 you should then shut down the system, and boot on the disk that
525 you just created following the procedure in step (3) above.
526 .Sh 4 "Step 5: placing labels on the disks"
527 .PP
528 For each disk on the HP300, \*(4B places information about the geometry
529 of the drive and the partition layout at byte offset 1024.
530 This information is written with
531 .Xr disklabel (8).
532 .PP
533 The root image just loaded includes a ``generic'' label intended to allow
534 easy installation of the root and
535 .Pn /usr
536 and may not be suitable for the actual
537 disk on which it was installed.
538 In particular,
539 it may make your disk appear larger or smaller than its real size.
540 In the former case, you lose some capacity.
541 In the latter, some of the partitions may map non-existent sectors
542 leading to errors if those partitions are used.
543 It is also possible that the defined geometry will interact poorly with
544 the filesystem code resulting in reduced performance.
545 However, as long as you are willing to give up a little space,
546 not use certain partitions or suffer minor performance degradation,
547 you might want to avoid this step;
548 especially if you do not know how to use
549 .Xr ed (1).
550 .PP
551 If you choose to edit this label,
552 you can fill in correct geometry information from
553 .Pn /etc/disktab .
554 You may also want to rework the ``e'' and ``f'' partitions used for loading
555 .Pn /usr
556 and
557 .Pn /var .
558 You should not attempt to, and
559 .Xr disklabel
560 will not let you, modify the ``a'', ``b'' and ``d'' partitions.
561 To edit a label:
562 .DS
563 \fB#\fP \fIEDITOR=ed\fP
564 \fB#\fP \fIexport EDITOR\fP
565 \fB#\fP \fIdisklabel  -r  -e  /dev/r\fBXX#\fPd
566 .DE
567 where \fBXX\fP is the type and \fB#\fP is the logical drive number; e.g.
568 .Pn /dev/rsd0d
569 or
570 .Pn /dev/rrd0d .
571 Note the explicit use of the ``d'' partition.
572 This partition includes the bootblock as does ``c''
573 and using it allows you to change the size of ``c''.
574 .PP
575 If you wish to label any additional disks, run the following command for each:
576 .DS
577 \fB#\|\fP\fIdisklabel  -rw  \fBXX#  type\fP  \fI"optional_pack_name"\fP
578 .DE
579 where \fBXX#\fP is the same as in the previous command
580 and \fBtype\fP is the HP300 disk device name as listed in
581 .Pn /etc/disktab .
582 The optional information may contain any descriptive name for the
583 contents of a disk, and may be up to 16 characters long.  This procedure
584 will place the label on the disk using the information found in
585 .Pn /etc/disktab
586 for the disk type named.
587 If you have changed the disk partition sizes,
588 you may wish to add entries for the modified configuration in
589 .Pn /etc/disktab
590 before labeling the affected disks.
591 .PP
592 You have now completed the HP300 specific part of the installation.
593 Now proceed to the generic part of the installation
594 described starting in section 2.5 below.
595 Note that where the disk name ``sd'' is used throughout section 2.5,
596 you should substitute the name ``rd'' if you are running on an HP-IB disk.
597 Also, if you are loading on a single disk with the default disklabel,
598 .Pn /var
599 should be restored to the ``f'' partition and
600 .Pn /usr
601 to the ``e'' partition.
602 .Sh 2 "Booting the SPARC"
603 .Sh 3 "Supported hardware"
604 .LP
605 The hardware supported by \*(4B for the SPARC is as follows:
606 .TS
607 center box;
608 lw(1i) lw(4i).
609 CPU's   T{
610 SPARCstation 1 series (1, 1+, SLC, IPC) and
611 SPARCstation 2 series (2, IPX).
612 T}
613 _
614 DISK's  T{
615 SCSI.
616 T}
617 _
618 TAPE's  T{
619 none.
620 T}
621 _
622 NETWORK T{
623 SPARCstation Lance (le).
624 T}
625 _
626 GRAPHICS        T{
627 bwtwo and cgthree.
628 T}
629 _
630 INPUT   T{
631 Keyboard and mouse.
632 T}
633 _
634 MISC    T{
635 Battery-backed real time clock,
636 built-in serial devices,
637 Sbus SCSI controller,
638 and audio device.
639 T}
640 .TE
641 .LP
642 Major items that are not supported include
643 anything VME-based,
644 the GX (cgsix) display,
645 the floppy disk, and SCSI tapes.
646 .Sh 3 "Limitations"
647 .LP
648 There are several important limitations on the \*(4B distribution
649 for the SPARC:
650 .IP 1)
651 You
652 .B must
653 have SunOS 4.1.x or Solaris to bring up \*(4B.
654 There is no SPARCstation bootstrap code in this distribution.  The
655 Sun-supplied boot loader will be used to boot \*(4B; you must copy
656 this from your SunOS distribution.  This imposes several
657 restrictions on the system, as detailed below.
658 .IP 2)
659 The \*(4B SPARC kernel does not remap SCSI IDs.  A SCSI disk at
660 target 0 will become ``sd0'', where in SunOS the same disk will
661 normally be called ``sd3''.  If your existing SunOS system is
662 diskful, it will be least painful to have SunOS running on the disk
663 on target 0 lun 0 and put \*(4B on the disk on target 3 lun 0.  Both
664 systems will then think they are running on ``sd0'', and you can
665 boot either system as needed simply by changing the EEPROM's boot
666 device.
667 .IP 3)
668 There is no SCSI tape driver.
669 You must have another system for tape reading and backups.
670 .IP 4)
671 Although the \*(4B SPARC kernel will handle existing SunOS shared
672 libraries, it does not use or create them itself, and therefore
673 requires much more disk space than SunOS does.
674 .IP 5)
675 It is currently difficult (though not completely impossible) to
676 run \*(4B diskless.  These instructions assume you will have a local
677 boot, swap, and root filesystem.
678 .IP 6)
679 When using a serial port rather than a graphics display as the console,
680 only port
681 .Pn ttya
682 can be used.
683 Attempts to use port
684 .Pn ttyb
685 will fail when the kernel tries
686 to print the boot up messages to the console.
687 .Sh 3 "The procedure"
688 .PP
689 You must have a spare disk on which to place \*(4B.
690 The steps involved in bootstrapping this tape are as follows:
691 .IP 1)
692 Bring up SunOS (preferably SunOS 4.1.x or Solaris 1.x, although
693 Solaris 2 may work \(em this is untested).
694 .IP 2)
695 Attach auxiliary SCSI disk(s).  Format and label using the
696 SunOS formatting and labeling programs as needed.
697 Note that the root filesystem currently requires at least 10 MB; 16 MB
698 or more is recommended.  The b partition will be used for swap;
699 this should be at least 32 MB.
700 .IP 3)
701 Use the SunOS
702 .Xr newfs
703 to build the root filesystem.  You may also
704 want to build other filesystems at the same time.  (By default, the
705 \*(4B
706 .Xr newfs
707 builds a filesystem that SunOS will not handle; if you
708 plan to switch OSes back and forth you may want to sacrifice the
709 performance gain from the new filesystem format for compatibility.)
710 You can build an old-format filesystem on \*(4B by giving the \-O
711 option to
712 .Xr newfs (8).
713 .Xr Fsck (8)
714 can convert old format filesystems to new format
715 filesystems, but not vice versa,
716 so you may want to initially build old format filesystems so that they
717 can be mounted under SunOS,
718 and then later convert them to new format filesystems when you are
719 satisfied that \*(4B is running properly.
720 In any case,
721 .B
722 you must build an old-style root filesystem
723 .R
724 so that the SunOS boot program will work.
725 .IP 4)
726 Mount the new root, then copy the SunOS
727 .Pn /boot
728 into place and use the SunOS ``installboot'' program
729 to enable disk-based booting.
730 Note that the filesystem must be mounted when you do the ``installboot'':
731 .DS
732 .ft CW
733 # mount /dev/sd3a /mnt
734 # cp /boot /mnt/boot
735 # cd /usr/kvm/mdec
736 # installboot /mnt/boot bootsd /dev/rsd3a
737 .DE
738 The SunOS
739 .Pn /boot
740 will load \*(4B kernels; there is no SPARCstation
741 bootstrap code on the distribution.  Note that the SunOS
742 .Pn /boot
743 does not handle the new \*(4B filesystem format.
744 .IP 5)
745 Restore the contents of the \*(4B root filesystem.
746 .DS
747 .ft CW
748 # cd /mnt
749 # rrestore xf tapehost:/dev/nrst0
750 .DE
751 .IP 6)
752 Boot the supplied kernel:
753 .DS
754 .ft CW
755 # halt
756 ok boot sd(0,3)kernel -s                [for old proms] OR
757 ok boot disk3 -s                        [for new proms]
758 \&... [\*(4B boot messages]
759 .DE
760 .LP
761 To install the remaining filesystems, use the procedure described
762 starting in section 2.5.
763 In these instructions,
764 .Pn /usr
765 should be loaded into the ``e'' partition and
766 .Pn /var
767 in the ``f'' partition.
768 .LP
769 After completing the filesystem installation you may want
770 to set up \*(4B to reboot automatically:
771 .DS
772 .ft CW
773 # halt
774 ok setenv boot-from sd(0,3)kernel       [for old proms] OR
775 ok setenv boot-device disk3             [for new proms]
776 .DE
777 If you build backwards-compatible filesystems, either with the SunOS
778 newfs or with the \*(4B ``\-O'' option, you can mount these under
779 SunOS.  The SunOS fsck will, however, always think that these filesystems
780 are corrupted, as there are several new (previously unused)
781 superblock fields that are updated in \*(4B.  Running ``fsck \-b32''
782 and letting it ``fix'' the superblock will take care of this.
783 .sp 0.5
784 If you wish to run SunOS binaries that use SunOS shared libraries, you
785 simply need to copy all the dynamic linker files from an existing
786 SunOS system:
787 .DS
788 .ft CW
789 # rcp sunos-host:/etc/ld.so.cache /etc/
790 # rcp sunos-host:'/usr/lib/*.so*' /usr/lib/
791 .DE
792 The SunOS compiler and linker should be able to produce SunOS binaries
793 under \*(4B, but this has not been tested.  If you plan to try it you
794 will need the appropriate .sa files as well.
795 .Sh 2 "Booting the DECstation"
796 .Sh 3 "Supported hardware"
797 .LP
798 The hardware supported by \*(4B for the DECstation is as follows:
799 .TS
800 center box;
801 lw(1i) lw(4i).
802 CPU's   T{
803 R2000 based (3100) and
804 R3000 based (5000/200, 5000/20, 5000/25, 5000/1xx).
805 T}
806 _
807 DISK's  T{
808 SCSI-I (tested RZ23, RZ55, RZ57, Maxtor 8760S).
809 T}
810 _
811 TAPE's  T{
812 SCSI-I (tested DEC TK50, Archive DAT, Emulex MT02).
813 T}
814 _
815 RS232   T{
816 Internal DEC dc7085 and AMD 8530 based interfaces.
817 T}
818 _
819 NETWORK T{
820 TURBOchannel PMAD-AA and internal LANCE based interfaces.
821 T}
822 _
823 GRAPHICS        T{
824 Terminal emulation and raw frame buffer support for
825 3100 (color & monochrome),
826 TURBOchannel PMAG-AA, PMAG-BA, PMAG-DV.
827 T}
828 _
829 INPUT   T{
830 Standard DEC keyboard (LK201) and mouse.
831 T}
832 _
833 MISC    T{
834 Battery-backed real time clock,
835 internal and TURBOchannel PMAZ-AA SCSI interfaces.
836 T}
837 .TE
838 .LP
839 Major items that are not supported include the 5000/240
840 (there is code but not compiled in or tested),
841 R4000 based machines, FDDI and audio interfaces.
842 Diskless machines are not supported but booting kernels and bootstrapping
843 over the network is supported on the 5000 series.
844 .Sh 3 "The procedure"
845 .PP
846 The first file on the distribution tape is a tar file that contains
847 four files.
848 The first step requires a running UNIX (or ULTRIX) system that can
849 be used to extract the tar archive from the first file on the tape.
850 The command:
851 .DS
852 .ft CW
853 tar xf /dev/rmt0
854 .DE
855 will extract the following four files:
856 .DS
857 A) root.image: \fIdd\fP image of the root filesystem
858 B) kernel.tape: \fIdd\fP image for creating boot tapes
859 C) kernel.net: file for booting over the network
860 D) root.dump: \fIdump\fP image of the root filesystem
861 .DE
862 There are three basic ways a system can be bootstrapped corresponding to the
863 first three files.
864 You may want to read the section on bootstrapping the HP300
865 since many of the steps are similar.
866 A spare, formatted SCSI disk is also useful.
867 .Sh 4 "Procedure A: copy root filesystem to disk"
868 .PP
869 This procedure is similar to the HP300.
870 If you have an extra disk, the easiest approach is to use \fIdd\fP\|(1)
871 under ULTRIX to copy the root filesystem image to the beginning
872 of the spare disk. 
873 The root filesystem image includes a disklabel and bootblock along with the
874 root filesystem.
875 An example command to copy the image to the beginning of a disk is:
876 .DS
877 .ft CW
878 dd if=root.image of=/dev/rz1c bs=\*(Bzb
879 .DE
880 The actual special file syntax will vary depending on unit numbers and
881 the version of ULTRIX that is running.
882 This system is now ready to boot. You can boot the kernel with one of the
883 following PROM commands. If you are booting on a 3100, the disk must be SCSI
884 id zero because of a bug.
885 .DS
886 .ft CW
887 DEC 3100:    boot \-f rz(0,0,0)kernel
888 DEC 5000:    boot 5/rz0/kernel
889 .DE
890 You can then proceed to section 2.5
891 to create reasonable disk partitions for your machine
892 and then install the rest of the system.
893 .Sh 4 "Procedure B: bootstrap from tape"
894 .PP
895 If you have only a single machine with a single disk,
896 you need to use the more difficult approach of booting a
897 kernel and mini-root from tape or the network, and using it to restore
898 the root filesystem.
899 .PP
900 First, you will need to create a boot tape. This can be done using
901 \fIdd\fP as in the following example.
902 .DS
903 .ft CW
904 dd if=kernel.tape of=/dev/nrmt0 bs=1b
905 dd if=root.dump of=/dev/nrmt0 bs=\*(Bzb
906 .DE
907 The actual special file syntax for the tape drive will vary depending on
908 unit numbers, tape device and the version of ULTRIX that is running.
909 .PP
910 The first file on the boot tape contains a boot header, kernel, and
911 mini-root filesystem that the PROM can copy into memory.
912 Installing from tape has only been tested
913 on a 3100 and a 5000/200 using a TK50 tape drive. Here are two example
914 PROM commands to boot from tape.
915 .DS
916 .ft CW
917 DEC 3100:    boot \-f tz(0,5,0) m    # 5 is the SCSI id of the TK50
918 DEC 5000:    boot 5/tz6 m           # 6 is the SCSI id of the TK50
919 .DE
920 The `m' argument tells the kernel to look for a root filesystem in memory.
921 Next you should proceed to section 2.4.3 to build a disk-based root filesystem.
922 .Sh 4 "Procedure C: bootstrap over the network"
923 .PP
924 You will need a host machine that is running the \fIbootp\fP server 
925 with the
926 .Pn kernel.net
927 file installed in the default directory defined by the
928 configuration file for
929 .Xr bootp .
930 Here are two example PROM commands to boot across the net:
931 .DS
932 .ft CW
933 DEC 3100:       boot \-f tftp()kernel.net m
934 DEC 5000:       boot 6/tftp/kernel.net m
935 .DE
936 This command should load the kernel and mini-root into memory and
937 run the same as the tape install (procedure B).
938 The rest of the steps are the same except
939 you will need to start the network
940 (if you are unsure how to fill in the <name> fields below,
941 see sections 4.4 and 5).
942 Execute the following to start the networking:
943 .DS
944 .ft CW
945 # mount \-uw /
946 # echo 127.0.0.1 localhost >> /etc/hosts
947 # echo <your.host.inet.number> myname.my.domain myname >> /etc/hosts
948 # echo <friend.host.inet.number> myfriend.my.domain myfriend >> /etc/hosts
949 # ifconfig le0 inet myname
950 .DE
951 Next you should proceed to section 2.4.3 to build a disk-based root filesystem.
952 .Sh 3 "Label disk and create the root filesystem"
953 .LP
954 There are five steps to create a disk-based root filesystem.
955 .IP 1)
956 Label the disk.
957 .DS
958 .ft CW
959 # disklabel -W /dev/rrz?c               # This enables writing the label
960 # disklabel -w -r -B /dev/rrz?c $DISKTYPE
961 # newfs /dev/rrz?a
962 \&...
963 # fsck /dev/rrz?a
964 \&...
965 .DE
966 Supported disk types are listed in
967 .Pn /etc/disktab .
968 .IP 2)
969 Restore the root filesystem.
970 .DS
971 .ft CW
972 # mount \-uw /
973 # mount /dev/rz?a /a
974 # cd /a
975 .DE
976 .ti +0.4i
977 If you are restoring locally (procedure B), run:
978 .DS
979 .ft CW
980 # mt \-f /dev/nrmt0 rew
981 # restore \-xsf 2 /dev/rmt0
982 .DE
983 .ti +0.4i
984 If you are restoring across the net (procedure c), run:
985 .DS
986 .ft CW
987 # rrestore xf myfriend:/path/to/root.dump
988 .DE
989 .ti +0.4i
990 When the restore finishes, clean up with:
991 .DS
992 .ft CW
993 # cd /
994 # sync
995 # umount /a
996 # fsck /dev/rz?a
997 .DE
998 .IP 3)
999 Reset the system and initialize the PROM monitor to boot automatically.
1000 .DS
1001 .ft CW
1002 DEC 3100:       setenv bootpath boot \-f rz(0,?,0)kernel
1003 DEC 5000:       setenv bootpath 5/rz?/kernel -a
1004 .DE
1005 .IP 4)
1006 After booting UNIX, you will need to create
1007 .Pn /dev/mouse
1008 to run X Window System as in the following example.
1009 .DS
1010 .ft CW
1011 rm /dev/mouse
1012 ln /dev/xx /dev/mouse
1013 .DE
1014 The 'xx' should be one of the following:
1015 .DS
1016 pm0     raw interface to PMAX graphics devices
1017 cfb0    raw interface to TURBOchannel PMAG-BA color frame buffer
1018 xcfb0   raw interface to maxine graphics devices
1019 mfb0    raw interface to mono graphics devices
1020 .DE
1021 You can then proceed to section 2.5 to install the rest of the system.
1022 Note that where the disk name ``sd'' is used throughout section 2.5,
1023 you should substitute the name ``rz''.
1024 .Sh 2 "Disk configuration"
1025 .PP
1026 All architectures now have a root filesystem up and running and
1027 proceed from this point to layout filesystems to make use
1028 of the available space and to balance disk load for better system
1029 performance.
1030 .Sh 3 "Disk naming and divisions"
1031 .PP
1032 Each physical disk drive can be divided into up to 8 partitions;
1033 UNIX typically uses only 3 or 4 partitions.
1034 For instance, the first partition, \*(Dk0a,
1035 is used for a root filesystem, a backup thereof,
1036 or a small filesystem like,
1037 .Pn /var/tmp ;
1038 the second partition, \*(Dk0b,
1039 is used for paging and swapping; and
1040 a third partition, typically \*(Dk0e,
1041 holds a user filesystem.
1042 .PP
1043 The space available on a disk varies per device.
1044 Each disk typically has a paging area of 30 to 100 megabytes
1045 and a root filesystem of about 17 megabytes.
1046 .\" XXX check
1047 The distributed system binaries occupy about 150 (180 with X11R5) megabytes
1048 .\" XXX check
1049 while the major sources occupy another 250 (340 with X11R5) megabytes.
1050 The
1051 .Pn /var
1052 filesystem as delivered on the tape is only 2Mb,
1053 however it should have at least 50Mb allocated to it just for
1054 normal system activity.
1055 Usually it is allocated the last partition on the disk
1056 so that it can provide as much space as possible to the
1057 .Pn /var/users
1058 filesystem.
1059 See section 2.5.4 for further details on disk layouts.
1060 .PP
1061 Be aware that the disks have their sizes
1062 measured in disk sectors (usually 512 bytes), while the UNIX filesystem
1063 blocks are variable sized.
1064 If
1065 .Sm BLOCKSIZE=1k
1066 is set in the user's environment, all user programs report
1067 disk space in kilobytes, otherwise,
1068 disk sizes are always reported in units of 512-byte sectors\**.
1069 .FS
1070 You can thank System V intransigence and POSIX duplicity for
1071 requiring that 512-byte blocks be the units that programs report.
1072 .FE
1073 The
1074 .Pn /etc/disktab
1075 file used in labelling disks and making filesystems
1076 specifies disk partition sizes in sectors.
1077 .Sh 3 "Layout considerations"
1078 .PP
1079 There are several considerations in deciding how
1080 to adjust the arrangement of things on your disks.
1081 The most important is making sure that there is adequate space
1082 for what is required; secondarily, throughput should be maximized.
1083 Paging space is an important parameter.
1084 The system, as distributed, sizes the configured
1085 paging areas each time the system is booted.  Further,
1086 multiple paging areas of different sizes may be interleaved.
1087 .PP
1088 Many common system programs (C, the editor, the assembler etc.)
1089 create intermediate files in the
1090 .Pn /tmp
1091 directory, so the filesystem where this is stored also should be made
1092 large enough to accommodate most high-water marks.
1093 Typically,
1094 .Pn /tmp
1095 is constructed from a memory-based filesystem (see
1096 .Xr mount_mfs (8)).
1097 Programs that want their temporary files to persist
1098 across system reboots (such as editors) should use
1099 .Pn /var/tmp .
1100 If you plan to use a disk-based
1101 .Pn /tmp
1102 filesystem to avoid loss across system reboots, it makes
1103 sense to mount this in a ``root'' (i.e. first partition)
1104 filesystem on another disk.
1105 All the programs that create files in
1106 .Pn /tmp
1107 take care to delete them, but are not immune to rare events
1108 and can leave dregs.
1109 The directory should be examined every so often and the old
1110 files deleted.
1111 .PP
1112 The efficiency with which UNIX is able to use the CPU
1113 is often strongly affected by the configuration of disk controllers;
1114 it is critical for good performance to balance disk load.
1115 There are at least five components of the disk load that you can
1116 divide between the available disks:
1117 .IP 1)
1118 The root filesystem.
1119 .IP 2)
1120 The
1121 .Pn /var
1122 and
1123 .Pn /var/tmp
1124 filesystems.
1125 .IP 3)
1126 The
1127 .Pn /usr
1128 filesystem.
1129 .IP 4)
1130 The user filesystems.
1131 .IP 5)
1132 The paging activity.
1133 .LP
1134 The following possibilities are ones we have used at times
1135 when we had 2, 3 and 4 disks:
1136 .TS
1137 center doublebox;
1138 l | c s s
1139 l | lw(5) | lw(5) | lw(5).
1140         disks
1141 what    2       3       4
1142 _
1143 root    0       0       0
1144 var     1       2       3
1145 usr     1       1       1
1146 paging  0+1     0+2     0+2+3
1147 users   0       0+2     0+2
1148 archive x       x       3
1149 .TE
1150 .PP
1151 The most important things to consider are to
1152 even out the disk load as much as possible, and to do this by
1153 decoupling filesystems (on separate arms) between which heavy copying occurs.
1154 Note that a long term average balanced load is not important; it is
1155 much more important to have an instantaneously balanced
1156 load when the system is busy.
1157 .PP
1158 Intelligent experimentation with a few filesystem arrangements can
1159 pay off in much improved performance.  It is particularly easy to
1160 move the root, the
1161 .Pn /var
1162 and
1163 .Pn /var/tmp
1164 filesystems and the paging areas.  Place the
1165 user files and the
1166 .Pn /usr
1167 directory as space needs dictate and experiment
1168 with the other, more easily moved filesystems.
1169 .Sh 3 "Filesystem parameters"
1170 .PP
1171 Each filesystem is parameterized according to its block size,
1172 fragment size, and the disk geometry characteristics of the
1173 medium on which it resides.  Inaccurate specification of the disk
1174 characteristics or haphazard choice of the filesystem parameters
1175 can result in substantial throughput degradation or significant
1176 waste of disk space.  As distributed,
1177 filesystems are configured according to the following table.
1178 .DS
1179 .TS
1180 center;
1181 l l l.
1182 Filesystem      Block size      Fragment size
1183 _
1184 root    8 kbytes        1 kbytes
1185 usr     8 kbytes        1 kbytes
1186 users   4 kbytes        512 bytes
1187 .TE
1188 .DE
1189 .PP
1190 The root filesystem block size is
1191 made large to optimize bandwidth to the associated disk.
1192 The large block size is important as many of the most
1193 heavily used programs are demand paged out of the
1194 .Pn /bin
1195 directory.
1196 The fragment size of 1 kbyte is a ``nominal'' value to use
1197 with a filesystem.  With a 1 kbyte fragment size
1198 disk space utilization is about the same
1199 as with the earlier versions of the filesystem.
1200 .PP
1201 The filesystems for users have a 4 kbyte block
1202 size with 512 byte fragment size.  These parameters
1203 have been selected based on observations of the
1204 performance of our user filesystems.  The 4 kbyte
1205 block size provides adequate bandwidth while the
1206 512 byte fragment size provides acceptable space compaction
1207 and disk fragmentation.
1208 .PP
1209 Other parameters may be chosen in constructing filesystems,
1210 but the factors involved in choosing a block
1211 size and fragment size are many and interact in complex
1212 ways.  Larger block sizes result in better
1213 throughput to large files in the filesystem as
1214 larger I/O requests will then be done by the
1215 system.  However,
1216 consideration must be given to the average file sizes
1217 found in the filesystem and the performance of the
1218 internal system buffer cache.   The system
1219 currently provides space in the inode for
1220 12 direct block pointers, 1 single indirect block
1221 pointer, 1 double indirect block pointer,
1222 and 1 triple indirect block pointer.
1223 If a file uses only direct blocks, access time to
1224 it will be optimized by maximizing the block size.
1225 If a file spills over into an indirect block,
1226 increasing the block size of the filesystem may
1227 decrease the amount of space used
1228 by eliminating the need to allocate an indirect block.
1229 However, if the block size is increased and an indirect
1230 block is still required, then more disk space will be
1231 used by the file because indirect blocks are allocated
1232 according to the block size of the filesystem.
1233 .PP
1234 In selecting a fragment size for a filesystem, at least
1235 two considerations should be given.  The major performance
1236 tradeoffs observed are between an 8 kbyte block filesystem
1237 and a 4 kbyte block filesystem.  Because of implementation
1238 constraints, the block size versus fragment size ratio can not
1239 be greater than 8.  This means that an 8 kbyte filesystem
1240 will always have a fragment size of at least 1 kbytes.  If
1241 a filesystem is created with a 4 kbyte block size and a
1242 1 kbyte fragment size, then upgraded to an 8 kbyte block size
1243 and 1 kbyte fragment size, identical space compaction will be
1244 observed.  However, if a filesystem has a 4 kbyte block size
1245 and 512 byte fragment size, converting it to an 8K/1K
1246 filesystem will result in 4-8% more space being
1247 used.  This implies that 4 kbyte block filesystems that
1248 might be upgraded to 8 kbyte blocks for higher performance should
1249 use fragment sizes of at least 1 kbytes to minimize the amount
1250 of work required in conversion.
1251 .PP
1252 A second, more important, consideration when selecting the
1253 fragment size for a filesystem is the level of fragmentation
1254 on the disk.  With an 8:1 fragment to block ratio, storage fragmentation
1255 occurs much sooner, particularly with a busy filesystem running
1256 near full capacity.  By comparison, the level of fragmentation in a
1257 4:1 fragment to block ratio filesystem is one tenth as severe.  This
1258 means that on filesystems where many files are created and
1259 deleted, the 512 byte fragment size is more likely to result in apparent
1260 space exhaustion because of fragmentation.  That is, when the filesystem
1261 is nearly full, file expansion that requires locating a
1262 contiguous area of disk space is more likely to fail on a 512
1263 byte filesystem than on a 1 kbyte filesystem.  To minimize
1264 fragmentation problems of this sort, a parameter in the super
1265 block specifies a minimum acceptable free space threshold.  When
1266 normal users (i.e. anyone but the super-user) attempt to allocate
1267 disk space and the free space threshold is exceeded, the user is
1268 returned an error as if the filesystem were really full.  This
1269 parameter is nominally set to 5%; it may be changed by supplying
1270 a parameter to
1271 .Xr newfs (8),
1272 or by updating the super block of an existing filesystem using
1273 .Xr tunefs (8).
1274 .PP
1275 Finally, a third, less common consideration is the attributes of
1276 the disk itself.  The fragment size should not be smaller than the
1277 physical sector size of the disk.  As an example, the HP magneto-optical
1278 disks have 1024 byte physical sectors.  Using a 512 byte fragment size
1279 on such disks will work but is extremely inefficient.
1280 .PP
1281 Note that the above discussion considers block sizes of up to only 8k.
1282 As of the 4.4 release, the maximum block size has been increased to 64k.
1283 This allows an entirely new set of block/fragment combinations for which
1284 there is little experience to date.
1285 In general though, unless a filesystem is to be used
1286 for a special purpose application (for example, storing
1287 image processing data), we recommend using the
1288 values supplied above.
1289 Remember that the current
1290 implementation limits the block size to at most 64 kbytes
1291 and the ratio of block size versus fragment size must be 1, 2, 4, or 8.
1292 .PP
1293 The disk geometry information used by the filesystem
1294 affects the block layout policies employed.  The file
1295 .Pn /etc/disktab ,
1296 as supplied, contains the data for most
1297 all drives supported by the system.  Before constructing
1298 a filesystem with
1299 .Xr newfs (8)
1300 you should label the disk (if it has not yet been labeled,
1301 and the driver supports labels).
1302 If labels cannot be used, you must instead
1303 specify the type of disk on which the filesystem resides;
1304 .Xr newfs
1305 then reads
1306 .Pn /etc/disktab
1307 instead of the pack label.
1308 This file also contains the default
1309 filesystem partition
1310 sizes, and default block and fragment sizes.  To
1311 override any of the default values you can modify the file,
1312 edit the disk label,
1313 or use an option to
1314 .Xr newfs .
1315 .Sh 3 "Implementing a layout"
1316 .PP
1317 To put a chosen disk layout into effect, you should use the
1318 .Xr newfs (8)
1319 command to create each new filesystem.
1320 Each filesystem must also be added to the file
1321 .Pn /etc/fstab
1322 so that it will be checked and mounted when the system is bootstrapped.
1323 .PP
1324 First we will consider a system with a single disk.
1325 There is little real choice on how to do the layout;
1326 the root filesystem goes in the ``a'' partition,
1327 .Pn /usr
1328 goes in the ``e'' partition, and
1329 .Pn /var
1330 fills out the remainder of the disk in the ``f'' partition.
1331 This is the organization used if you loaded the disk-image root filesystem.
1332 With the addition of a memory-based
1333 .Pn /tmp
1334 filesystem, its fstab entry would be as follows:
1335 .TS
1336 center;
1337 lfC lfC l l n n.
1338 /dev/\*(Dk0a    /       ufs     rw      1       1
1339 /dev/\*(Dk0b    none    swap    sw      0       0
1340 /dev/\*(Dk0b    /tmp    mfs     rw,-s=14000,-b=8192,-f=1024,-T=sd660    0       0
1341 /dev/\*(Dk0e    /usr    ufs     ro      1       2
1342 /dev/\*(Dk0f    /var    ufs     rw      1       2
1343 .TE
1344 .PP
1345 If we had a second disk, we would split the load between the drives.
1346 On the second disk, we place the
1347 .Pn /usr
1348 and
1349 .Pn /var
1350 filesystems in their usual \*(Dk1e and \*(Dk1f
1351 partitions respectively.
1352 The \*(Dk1b partition would be used as a second paging area,
1353 and the \*(Dk1a partition left as a spare root filesystem
1354 (alternatively \*(Dk1a could be used for
1355 .Pn /var/tmp ).
1356 The first disk still holds the
1357 the root filesystem in \*(Dk0a, and the primary swap area in \*(Dk0b.
1358 The \*(Dk0e partition is used to hold home directories in
1359 .Pn /var/users .
1360 The \*(Dk0f partition can be used for
1361 .Pn /usr/src
1362 or alternately the \*(Dk0e partition can be extended to cover
1363 the rest of the disk with
1364 .Xr disklabel (8).
1365 As before, the
1366 .Pn /tmp
1367 directory is a memory-based filesystem.
1368 Note that to interleave the paging between the two disks
1369 you must build a system configuration that specifies:
1370 .DS
1371 config  kernel  root on \*(Dk0 swap on \*(Dk0 and \*(Dk1
1372 .DE
1373 The
1374 .Pn /etc/fstab
1375 file would then contain
1376 .TS
1377 center;
1378 lfC lfC l l n n.
1379 /dev/\*(Dk0a    /       ufs     rw      1       1
1380 /dev/\*(Dk0b    none    swap    sw      0       0
1381 /dev/\*(Dk1b    none    swap    sw      0       0
1382 /dev/\*(Dk0b    /tmp    mfs     rw,-s=14000,-b=8192,-f=1024,-T=sd660    0       0
1383 /dev/\*(Dk1e    /usr    ufs     ro      1       2
1384 /dev/\*(Dk0f    /usr/src        ufs     rw      1       2
1385 /dev/\*(Dk1f    /var    ufs     rw      1       2
1386 /dev/\*(Dk0e    /var/users      ufs     rw      1       2
1387 .TE
1388 .PP
1389 To make the
1390 .Pn /var
1391 filesystem we would do:
1392 .DS
1393 \fB#\fP \fIcd /dev\fP
1394 \fB#\fP \fIMAKEDEV \*(Dk1\fP
1395 \fB#\fP \fIdisklabel -wr \*(Dk1 "disk type" "disk name"\fP
1396 \fB#\fP \fInewfs \*(Dk1f\fP
1397 (information about filesystem prints out)
1398 \fB#\fP \fImkdir /var\fP
1399 \fB#\fP \fImount /dev/\*(Dk1f /var\fP
1400 .DE
1401 .Sh 2 "Installing the rest of the system"
1402 .PP
1403 At this point you should have your disks partitioned.
1404 The next step is to extract the rest of the data from the tape.
1405 At a minimum you need to set up the
1406 .Pn /var
1407 and
1408 .Pn /usr
1409 filesystems.
1410 You may also want to extract some or all the program sources.
1411 Since not all architectures support tape drives or don't support the
1412 correct ones, you may need to extract the files indirectly using
1413 .Xr rsh (1).
1414 For example, for a directly connected tape drive you might do:
1415 .DS
1416 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP
1417 \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP
1418 .DE
1419 The equivalent indirect procedure (where the tape drive is on machine ``foo'')
1420 is:
1421 .DS
1422 \fB#\fP \fIrsh foo mt -f /dev/nr\*(Mt0 fsf\fP
1423 \fB#\fP \fIrsh foo dd if=/dev/nr\*(Mt0 bs=\*(Bzb | tar xbpf \*(Bz -\fP
1424 .DE
1425 Obviously, the target machine must be connected to the local network
1426 for this to work.
1427 To do this:
1428 .DS
1429 \fB#\fP \fIecho  127.0.0.1  localhost >> /etc/hosts\fP
1430 \fB#\fP \fIecho  \fPyour.host.inet.number  myname.my.domain  myname\fI >> /etc/hosts\fP
1431 \fB#\fP \fIecho  \fPfriend.host.inet.number  myfriend.my.domain  myfriend\fI >> /etc/hosts\fP
1432 \fB#\fP \fIifconfig  le0  inet  \fPmyname
1433 .DE
1434 where the ``host.inet.number'' fields are the IP addresses for your host and
1435 the host with the tape drive
1436 and the ``my.domain'' fields are the names of your machine and the tape-hosting
1437 machine.
1438 See sections 4.4 and 5 for more information on setting up the network.
1439 .PP
1440 Assuming a directly connected tape drive, here is how to extract and
1441 install
1442 .Pn /var
1443 and
1444 .Pn /usr :
1445 .br
1446 .ne 5
1447 .TS
1448 lw(2i) l.
1449 \fB#\fP \fImount \-uw /dev/\*(Dk#a /\fP (read-write mount root filesystem)
1450 \fB#\fP \fIdate yymmddhhmm\fP   (set date, see \fIdate\fP\|(1))
1451 \&....
1452 \fB#\fP \fIpasswd -l root\fP    (set password for super-user)
1453 \fBNew password:\fP     (password will not echo)
1454 \fBRetype new password:\fP
1455 \fB#\fP \fIpasswd -l toor\fP    (set password for super-user)
1456 \fBNew password:\fP     (password will not echo)
1457 \fBRetype new password:\fP
1458 \fB#\fP \fIhostname mysitename\fP       (set your hostname)
1459 \fB#\fP \fInewfs r\*(Dk#p\fP    (create empty user filesystem)
1460 (\fI\*(Dk\fP is the disk type, \fI#\fP is the unit number,
1461 \fIp\fP is the partition; this takes a few minutes)
1462 \fB#\fP \fImount /dev/\*(Dk#p /var\fP   (mount the var filesystem)
1463 \fB#\fP \fIcd /var\fP   (make /var the current directory)
1464 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1465 \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP      (extract all of var)
1466 (this takes a few minutes)
1467 \fB#\fP \fInewfs r\*(Dk#p\fP    (create empty user filesystem)
1468 (as before \fI\*(Dk\fP is the disk type, \fI#\fP is the unit number,
1469 \fIp\fP is the partition)
1470 \fB#\fP \fImount /dev/\*(Dk#p /mnt\fP   (mount the new /usr in temporary location)
1471 \fB#\fP \fIcd /mnt\fP   (make /mnt the current directory)
1472 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1473 \fB#\fP \fItar xbpf \*(Bz /dev/nr\*(Mt0\fP      (extract all of usr except usr/src)
1474 (this takes about 15-20 minutes)
1475 \fB#\fP \fIcd /\fP      (make / the current directory)
1476 \fB#\fP \fIumount /mnt\fP       (unmount from temporary mount point)
1477 \fB#\fP \fIrm -r /usr/*\fP      (remove excess bootstrap binaries)
1478 \fB#\fP \fImount /dev/\*(Dk#p /usr\fP   (remount /usr)
1479 .TE
1480 If no disk label has been installed on the disk, the
1481 .Xr newfs
1482 command will require a third argument to specify the disk type,
1483 using one of the names in
1484 .Pn /etc/disktab .
1485 If the tape had been rewound or positioned incorrectly before the
1486 .Xr tar ,
1487 to extract
1488 .Pn /var
1489 it may be repositioned by the following commands.
1490 .DS
1491 \fB#\fP \fImt -f /dev/nr\*(Mt0 rew\fP
1492 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf 1\fP
1493 .DE
1494 The data on the second and third tape files has now been extracted.
1495 If you are using 6250bpi tapes, the first reel of the
1496 distribution is no longer needed; you should now mount the second
1497 reel instead.  The installation procedure continues from this
1498 point on the 8mm tape.
1499 The next step is to extract the sources.
1500 As previously noted,
1501 .Pn /usr/src
1502 .\" XXX Check
1503 requires about 250-340Mb of space.
1504 Ideally sources should be in a separate filesystem;
1505 if you plan to put them into your
1506 .Pn /usr
1507 filesystem, it will need at least 500Mb of space.
1508 Assuming that you will be using a separate filesystem on \*(Dk0f for
1509 .Pn /usr/src ,
1510 you will start by creating and mounting it:
1511 .DS
1512 \fB#\fP \fInewfs \*(Dk0f\fP
1513 (information about filesystem prints out)
1514 \fB#\fP \fImkdir /usr/src\fP
1515 \fB#\fP \fImount /dev/\*(Dk0f /usr/src\fP
1516 .DE
1517 .LP
1518 First you will extract the kernel source:
1519 .DS
1520 .TS
1521 lw(2i) l.
1522 \fB#\fP \fIcd /usr/src\fP
1523 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1524 (this should only be done on Exabyte distributions)
1525 \fB#\fP \fItar xpbf \*(Bz /dev/nr\*(Mt0\fP      (extract the kernel sources)
1526 (this takes about 15-30 minutes)
1527 .TE
1528 .DE
1529 .LP
1530 The next tar file contains the sources for the utilities.
1531 It is extracted as follows:
1532 .DS
1533 .TS
1534 lw(2i) l.
1535 \fB#\fP \fIcd /usr/src\fP
1536 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1537 \fB#\fP \fItar xpbf \*(Bz /dev/rmt12\fP         (extract the utility source)
1538 (this takes about 30-60 minutes)
1539 .TE
1540 .DE
1541 .PP
1542 If you are using 6250bpi tapes, the second reel of the
1543 distribution is no longer needed; you should now mount the third
1544 reel instead.  The installation procedure continues from this
1545 point on the 8mm tape.
1546 .PP
1547 The next tar file contains the sources for the contributed software.
1548 It is extracted as follows:
1549 .DS
1550 .TS
1551 lw(2i) l.
1552 \fB#\fP \fIcd /usr/src\fP
1553 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1554 (this should only be done on Exabyte distributions)
1555 \fB#\fP \fItar xpbf \*(Bz /dev/rmt12\fP         (extract the contributed software source)
1556 (this takes about 30-60 minutes)
1557 .TE
1558 .DE
1559 .PP
1560 If you received a distribution on 8mm Exabyte tape,
1561 there is one additional tape file on the distribution tape
1562 that has not been installed to this point; it contains the
1563 sources for X11R5 in
1564 .Xr tar (1)
1565 format.  As distributed, X11R5 should be placed in
1566 .Pn /usr/src/X11R5 .
1567 .DS
1568 .TS
1569 lw(2i) l.
1570 \fB#\fP \fIcd /usr/src\fP
1571 \fB#\fP \fImt -f /dev/nr\*(Mt0 fsf\fP   (space to end of previous tape file)
1572 \fB#\fP \fItar xpbf \*(Bz /dev/nr\*(Mt0\fP      (extract the X11R5 source)
1573 (this takes about 30-60 minutes)
1574 .TE
1575 .DE
1576 Many of the X11 utilities search using the path
1577 .Pn /usr/X11 ,
1578 so be sure that you have a symbolic link that points at
1579 the location of your X11 binaries (here, X11R5).
1580 .PP
1581 Having now completed the extraction of the sources, 
1582 you may want to verify that your
1583 .Pn /usr/src
1584 filesystem is consistent.
1585 To do so, you must unmount it, and run
1586 .Xr fsck (8);
1587 assuming that you used \*(Dk0f you would proceed as follows:
1588 .DS
1589 .TS
1590 lw(2i) l.
1591 \fB#\fP \fIcd /\fP      (change directory, back to the root)
1592 \fB#\fP \fIumount /usr/src\fP   (unmount /usr/src)
1593 \fB#\fP \fIfsck /dev/r\*(Dk0f\fP
1594 .TE
1595 .DE
1596 The output from
1597 .Xr fsck
1598 should look something like:
1599 .DS
1600 .B
1601 ** /dev/r\*(Dk0f
1602 ** Last Mounted on /usr/src
1603 ** Phase 1 - Check Blocks and Sizes
1604 ** Phase 2 - Check Pathnames
1605 ** Phase 3 - Check Connectivity
1606 ** Phase 4 - Check Reference Counts
1607 ** Phase 5 - Check Cyl groups
1608 23000 files, 261000 used, 39000 free (2200 frags, 4600 blocks)
1609 .R
1610 .DE
1611 .PP
1612 If there are inconsistencies in the filesystem, you may be prompted
1613 to apply corrective action; see the
1614 .Xr fsck (8)
1615 or \fIFsck \(en The UNIX File System Check Program\fP (SMM:3) for more details.
1616 .PP
1617 To use the
1618 .Pn /usr/src
1619 filesystem, you should now remount it with:
1620 .DS
1621 \fB#\fP \fImount /dev/\*(Dk0f /usr/src\fP
1622 .DE
1623 or if you have made an entry for it in
1624 .Pn /etc/fstab
1625 you can remount it with:
1626 .DS
1627 \fB#\fP \fImount /usr/src\fP
1628 .DE
1629 .Sh 2 "Additional conversion information"
1630 .PP
1631 After setting up the new \*(4B filesystems, you may restore the user
1632 files that were saved on tape before beginning the conversion.
1633 Note that the \*(4B
1634 .Xr restore
1635 program does its work on a mounted filesystem using normal system operations.
1636 This means that filesystem dumps may be restored even
1637 if the characteristics of the filesystem changed.
1638 To restore a dump tape for, say, the
1639 .Pn /a
1640 filesystem something like the following would be used:
1641 .DS
1642 \fB#\fP \fImkdir /a\fP
1643 \fB#\fP \fInewfs \*(Dk#p\fI
1644 \fB#\fP \fImount /dev/\*(Dk#p /a\fP
1645 \fB#\fP \fIcd /a\fP
1646 \fB#\fP \fIrestore x\fP
1647 .DE
1648 .PP
1649 If
1650 .Xr tar
1651 images were written instead of doing a dump, you should
1652 be sure to use its `\-p' option when reading the files back.  No matter
1653 how you restore a filesystem, be sure to unmount it and check its
1654 integrity with
1655 .Xr fsck (8)
1656 when the job is complete.