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