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