Import mdocml-1.9.14:
[netbsd-mini2440.git] / usr.sbin / bad144 / bad144.8
blobc10dc5dd89394dccd9ff97ccdac801ab542921d3
1 .\" Copyright (c) 1980, 1988, 1991, 1993
2 .\"     The Regents of the University of California.  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 .\"     from: @(#)bad144.8      8.1 (Berkeley) 6/6/93
29 .\"     $NetBSD: bad144.8,v 1.15 2003/08/07 11:25:12 agc Exp $
30 .\"
31 .Dd June 6, 1993
32 .Dt BAD144 8
33 .Os
34 .Sh NAME
35 .Nm bad144
36 .Nd read/write DEC standard 144 bad sector information
37 .Sh SYNOPSIS
38 .Nm
39 .Op Fl c
40 .Op Fl f
41 .Op Fl v
42 .Ar disk
43 .Oo
44 .Ar sno
45 .Op Ar bad ...
46 .Oc
47 .Nm
48 .Fl a
49 .Op Fl c
50 .Op Fl f
51 .Op Fl v
52 .Ar disk
53 .Op Ar bad ...
54 .Sh DESCRIPTION
55 .Nm
56 can be used to inspect the information stored on a disk that is used by
57 the disk drivers to implement bad sector forwarding.
58 The
59 .Nm
60 tool is only installed on supported platforms.
61 .Pp
62 Available options:
63 .Pp
64 .Bl -tag -width Ds
65 .It Fl a
66 The argument list consists of new bad sectors to be added to an existing
67 list.
68 The new sectors are sorted into the list,
69 which must have been in order.
70 Replacement sectors are moved to accommodate the additions;
71 the new replacement sectors are cleared.
72 .It Fl c
73 Forces an attempt to copy the old sector to the replacement,
74 and may be useful when replacing an unreliable sector.
75 .It Fl f
76 .Pq vax only
77 For a RP06, RM03, RM05, Fujitsu Eagle,
79 .Tn SMD
80 disk on a MASSBUS, the
81 .Fl f
82 option may be used to mark the new bad sectors as ``bad''
83 by reformatting them as unusable sectors.
84 This option is
85 .Em required unless
86 the sectors have already been marked bad,
87 or the system will not be notified that it should use the replacement sector.
88 This option may be used while running multiuser; it is no longer necessary
89 to perform format operations while running single-user.
90 .It Fl v
91 The entire process is described as it happens in gory detail if
92 .Fl v
93 (verbose) is given.
94 .El
95 .Pp
96 The format of
97 the information is specified by
98 .Tn DEC
99 standard 144, as follows.
100 The bad sector information is located in the first 5 even numbered sectors
101 of the last track of the disk pack.  There are five identical copies of
102 the information, described by the
103 .Ar dkbad
104 structure.
106 Replacement sectors are allocated starting with the first sector before
107 the bad sector information and working backwards towards the beginning
108 of the disk.  A maximum of 126 bad sectors are supported.  The position
109 of the bad sector in the bad sector table determines the replacement
110 sector to which it corresponds.
111 The bad sectors must be listed in ascending order.
113 The bad sector information and replacement sectors are conventionally
114 only accessible through the ``c'' file system partition of the disk.  If
115 that partition is used for a file system, the user is responsible for
116 making sure that it does not overlap the bad sector information or any
117 replacement sectors.
118 Thus, one track plus 126 sectors must be reserved to allow use
119 of all of the possible bad sector replacements.
121 The bad sector structure is as follows:
122 .Bd -literal
123 struct dkbad {
124         int32_t   bt_csn;               /* cartridge serial number */
125         u_int16_t bt_mbz;               /* unused; should be 0 */
126         u_int16_t bt_flag;              /* -1 =\*[Gt] alignment cartridge */
127         struct bt_bad {
128                 u_int16_t bt_cyl;       /* cylinder number of bad sector */
129                 u_int16_t bt_trksec;    /* track and sector number */
130         } bt_bad[126];
134 Unused slots in the
135 .Ar bt_bad
136 array are filled with all bits set, a putatively
137 illegal value.
140 is invoked by giving a device name (e.g. wd0, hk0, hp1, etc.).
141 With no optional arguments
142 it reads the first sector of the last track
143 of the corresponding disk and prints out the bad sector information.
144 It issues a warning if the bad sectors are out of order.
146 may also be invoked with a serial number for the pack and a list
147 of bad sectors.
148 It will write the supplied information into all copies
149 of the bad-sector file, replacing any previous information.
150 Note, however, that
152 does not arrange for the specified sectors to be marked bad in this case.
153 This procedure should only be used to restore known bad sector
154 information which was destroyed.
156 It is no longer necessary to reboot to allow the kernel
157 to reread the bad-sector table from the drive.
158 .Sh SEE ALSO
159 .Xr badsect 8
160 .Sh HISTORY
163 command appeared in
164 .Bx 4.1 .
165 .Sh BUGS
166 It should be possible to format disks on-line under
167 .Bx 4 .
169 It should be possible to mark bad sectors on drives of all type.
171 On an 11/750,
172 the standard bootstrap drivers used to boot the system do
173 not understand bad sectors,
174 handle
175 .Tn ECC
176 errors, or the special
177 .Tn SSE
178 (skip sector) errors of RM80-type disks.
179 This means that none of these errors can occur when reading the file
180 .Pa /netbsd
181 to boot.  Sectors 0-15 of the disk drive
182 must also not have any of these errors.
184 The drivers which write a system core image on disk after a crash do not
185 handle errors; thus the crash dump area must be free of errors and bad
186 sectors.