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