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