| 1 | .\" Copyright (c) 1980, 1988, 1991 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 | .\" @(#)bad144.8 6.7 (Berkeley) 3/16/91 |
| 33 | .\" |
| 34 | .Dd March 16, 1991 |
| 35 | .Dt BAD144 8 |
| 36 | .Os BSD 4 |
| 37 | .Sh NAME |
| 38 | .Nm bad144 |
| 39 | .Nd read/write dec standard 144 bad sector information |
| 40 | .Sh SYNOPSIS |
| 41 | .Nm bad144 |
| 42 | .Op Fl c |
| 43 | .Op Fl f |
| 44 | .Op Fl v |
| 45 | .Ar disk |
| 46 | .Oo |
| 47 | .Ar sno |
| 48 | .Op Ar bad ... |
| 49 | .Oc |
| 50 | .Nm bad144 |
| 51 | .Fl a |
| 52 | .Op Fl c |
| 53 | .Op Fl f |
| 54 | .Op Fl v |
| 55 | .Ar disk |
| 56 | .Op Ar bad ... |
| 57 | .Sh DESCRIPTION |
| 58 | .Nm Bad144 |
| 59 | can be used to inspect the information stored on a disk that is used by |
| 60 | the disk drivers to implement bad sector forwarding. |
| 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 | For a RP06, RM03, RM05, Fujitsu Eagle, |
| 77 | or |
| 78 | .Tn SMD |
| 79 | disk on a Massbus, the |
| 80 | .Fl f |
| 81 | option may be used to mark the new bad sectors as ``bad'' |
| 82 | by reformatting them as unusable sectors. |
| 83 | This option is |
| 84 | .Em required unless |
| 85 | the sectors have already been marked bad, |
| 86 | or the system will not be notified that it should use the replacement sector. |
| 87 | This option may be used while running multiuser; it is no longer necessary |
| 88 | to perform format operations while running single-user. |
| 89 | .It Fl v |
| 90 | The entire process is described as it happens in gory detail if |
| 91 | .Fl v |
| 92 | (verbose) is given. |
| 93 | .El |
| 94 | .Pp |
| 95 | The format of |
| 96 | the information is specified by |
| 97 | .Tn DEC |
| 98 | standard 144, as follows. |
| 99 | The bad sector information is located in the first 5 even numbered sectors |
| 100 | of the last track of the disk pack. There are five identical copies of |
| 101 | the information, described by the |
| 102 | .Ar dkbad |
| 103 | structure. |
| 104 | .Pp |
| 105 | Replacement sectors are allocated starting with the first sector before |
| 106 | the bad sector information and working backwards towards the beginning |
| 107 | of the disk. A maximum of 126 bad sectors are supported. The position |
| 108 | of the bad sector in the bad sector table determines the replacement |
| 109 | sector to which it corresponds. |
| 110 | The bad sectors must be listed in ascending order. |
| 111 | .Pp |
| 112 | The bad sector information and replacement sectors are conventionally |
| 113 | only accessible through the ``c'' file system partition of the disk. If |
| 114 | that partition is used for a file system, the user is responsible for |
| 115 | making sure that it does not overlap the bad sector information or any |
| 116 | replacement sectors. |
| 117 | Thus, one track plus 126 sectors must be reserved to allow use |
| 118 | of all of the possible bad sector replacements. |
| 119 | .Pp |
| 120 | The bad sector structure is as follows: |
| 121 | .Bd -literal |
| 122 | struct dkbad { |
| 123 | long bt_csn; /* cartridge serial number */ |
| 124 | u_short bt_mbz; /* unused; should be 0 */ |
| 125 | u_short bt_flag; /* -1 => alignment cartridge */ |
| 126 | struct bt_bad { |
| 127 | u_short bt_cyl; /* bad sector cylinder number */ |
| 128 | u_short bt_trksec; /* track and sector number */ |
| 129 | } bt_bad[126]; |
| 130 | }; |
| 131 | .Ed |
| 132 | .Pp |
| 133 | Unused slots in the |
| 134 | .Ar bt_bad |
| 135 | array are filled with all bits set, a putatively |
| 136 | illegal value. |
| 137 | .Pp |
| 138 | .Nm Bad144 |
| 139 | is invoked by giving a device name (e.g. hk0, hp1, etc.). |
| 140 | With no optional arguments |
| 141 | it reads the first sector of the last track |
| 142 | of the corresponding disk and prints out the bad sector information. |
| 143 | It issues a warning if the bad sectors are out of order. |
| 144 | .Nm Bad144 |
| 145 | may also be invoked with a serial number for the pack and a list |
| 146 | of bad sectors. |
| 147 | It will write the supplied information into all copies |
| 148 | of the bad-sector file, replacing any previous information. |
| 149 | Note, however, that |
| 150 | .Nm bad144 |
| 151 | does not arrange for the specified sectors to be marked bad in this case. |
| 152 | This procedure should only be used to restore known bad sector information which |
| 153 | was destroyed. |
| 154 | .Pp |
| 155 | It is no longer necessary to reboot to allow the kernel |
| 156 | to reread the bad-sector table from the drive. |
| 157 | .Sh SEE ALSO |
| 158 | .Xr badsect 8 , |
| 159 | .Xr format 8 |
| 160 | .Sh BUGS |
| 161 | It should be possible to format disks on-line under |
| 162 | .Tn UNIX . |
| 163 | .Pp |
| 164 | It should be possible to mark bad sectors on drives of all type. |
| 165 | .Pp |
| 166 | On an 11/750, |
| 167 | the standard bootstrap drivers used to boot the system do |
| 168 | not understand bad sectors, |
| 169 | handle |
| 170 | .Tn ECC |
| 171 | errors, or the special |
| 172 | .Tn SSE |
| 173 | (skip sector) errors of RM80-type disks. |
| 174 | This means that none of these errors can occur when reading the file |
| 175 | .Pa /386bsd |
| 176 | to boot. Sectors 0-15 of the disk drive |
| 177 | must also not have any of these errors. |
| 178 | .Pp |
| 179 | The drivers which write a system core image on disk after a crash do not |
| 180 | handle errors; thus the crash dump area must be free of errors and bad |
| 181 | sectors. |
| 182 | .Sh HISTORY |
| 183 | The |
| 184 | .Nm |
| 185 | command appeared in |
| 186 | .Bx 4.1 . |