BSD 4_3_Reno release
[unix-history] / usr / src / usr.sbin / bad144 / bad144.8
CommitLineData
80b4c61a 1.\" Copyright (c) 1980, 1988 Regents of the University of California.
c04656a2
KM
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
1c15e888 5.\" @(#)bad144.8 6.6 (Berkeley) 6/24/90
c04656a2 6.\"
1c15e888 7.TH BAD144 8 "June 24, 1990"
c04656a2
KM
8.UC 4
9.SH NAME
10bad144 \- read/write dec standard 144 bad sector information
11.SH SYNOPSIS
2c4605e5 12.B bad144
79d6ffc9
KM
13[
14.B \-f
51d860e6
MK
15] [
16.B \-c
17] [
18.B \-v
79d6ffc9 19]
b64fd1e2 20disk
c04656a2
KM
21[ sno [
22bad ...
23] ]
51d860e6 24.br
2c4605e5 25.B bad144
51d860e6
MK
26.B \-a
27[
28.B \-f
29] [
30.B \-c
31] [
32.B \-v
33]
b64fd1e2 34disk
51d860e6
MK
35[
36bad ...
37]
c04656a2
KM
38.SH DESCRIPTION
39.I Bad144
40can be used to inspect the information stored on a disk that is used by
41the disk drivers to implement bad sector forwarding. The format of
42the information is specified by DEC standard 144, as follows.
43.PP
44The bad sector information is located in the first 5 even numbered sectors
45of the last track of the disk pack. There are five identical copies of
79d6ffc9
KM
46the information, described by the
47.I dkbad
48structure.
c04656a2
KM
49.PP
50Replacement sectors are allocated starting with the first sector before
51the bad sector information and working backwards towards the beginning
52of the disk. A maximum of 126 bad sectors are supported. The position
51d860e6
MK
53of the bad sector in the bad sector table determines the replacement
54sector to which it corresponds.
79d6ffc9 55The bad sectors must be listed in ascending order.
c04656a2
KM
56.PP
57The bad sector information and replacement sectors are conventionally
79d6ffc9 58only accessible through the ``c'' file system partition of the disk. If
c04656a2
KM
59that partition is used for a file system, the user is responsible for
60making sure that it does not overlap the bad sector information or any
61replacement sectors.
51d860e6
MK
62Thus, one track plus 126 sectors must be reserved to allow use
63of all of the possible bad sector replacements.
c04656a2
KM
64.PP
65The bad sector structure is as follows:
66.PP
67.ta .75i 1.5i 3.5i
68.nf
69struct dkbad {
70 long bt_csn; /* cartridge serial number */
71 u_short bt_mbz; /* unused; should be 0 */
72 u_short bt_flag; /* -1 => alignment cartridge */
73 struct bt_bad {
74 u_short bt_cyl; /* cylinder number of bad sector */
75 u_short bt_trksec; /* track and sector number */
76 } bt_bad[126];
77};
78.fi
79.PP
79d6ffc9
KM
80Unused slots in the
81.I bt_bad
82array are filled with all bits set, a putatively
c04656a2
KM
83illegal value.
84.PP
85.I Bad144
b64fd1e2
MK
86is invoked by giving a device name (e.g. hk0, hp1, etc.).
87With no optional arguments
51d860e6 88it reads the first sector of the last track
c04656a2 89of the corresponding disk and prints out the bad sector information.
51d860e6
MK
90It issues a warning if the bad sectors are out of order.
91.I Bad144
92may also be invoked with a serial number for the pack and a list
93of bad sectors.
94It will write the supplied information into all copies
95of the bad-sector file, replacing any previous information.
96Note, however, that
c04656a2
KM
97.I bad144
98does not arrange for the specified sectors to be marked bad in this case.
51d860e6 99This procedure should only be used to restore known bad sector information which
c04656a2 100was destroyed.
51d860e6
MK
101.PP
102With the
103.B \-a
104option,
105the argument list consists of new bad sectors to be added to an existing
106list.
107The new sectors are sorted into the list,
108which must have been in order.
109Replacement sectors are moved to accommodate the additions;
110the new replacement sectors are cleared.
111The entire process is described as it happens in gory detail if
112.B \-v
113(verbose) is given.
114The
115.B \-c
116option forces an attempt to copy the old sector to the replacement,
117and may be useful when replacing an unreliable sector.
c04656a2 118.PP
51d860e6
MK
119If the disk is an RP06, RM03, RM05, Fujitsu Eagle,
120or SMD disk on a Massbus, the
79d6ffc9 121.B \-f
7391377d
MK
122option may be used to mark the new bad sectors as ``bad''
123by reformatting them as unusable sectors.
7391377d
MK
124This option is required unless the sectors have already been marked bad,
125or the system will not be notified that it should use the replacement sector.
80b4c61a
MK
126This option may be used while running multiuser; it is no longer necessary
127to perform format operations while running single-user.
b64fd1e2 128.PP
80b4c61a
MK
129It is no longer necessary to reboot to allow the kernel
130to reread the bad-sector table from the drive.
c04656a2 131.SH SEE ALSO
79d6ffc9
KM
132badsect(8),
133format(8V)
c04656a2 134.SH BUGS
79d6ffc9 135It should be possible to format disks on-line under UNIX.
c04656a2 136.PP
79d6ffc9
KM
137It should be possible to mark bad sectors on drives of all type.
138.PP
139On an 11/750,
140the standard bootstrap drivers used to boot the system do
141not understand bad sectors,
51d860e6 142handle ECC errors, or the special SSE (skip sector) errors of RM80-type disks.
c04656a2 143This means that none of these errors can occur when reading the file
79d6ffc9
KM
144/vmunix to boot. Sectors 0-15 of the disk drive
145must also not have any of these errors.
c04656a2
KM
146.PP
147The drivers which write a system core image on disk after a crash do not
148handle errors; thus the crash dump area must be free of errors and bad
149sectors.