date and time created 91/03/16 15:42:57 by donn
[unix-history] / usr / src / sbin / badsect / badsect.8
CommitLineData
14955f05
KB
1.\" Copyright (c) 1985 The Regents of the University of California.
2.\" All rights reserved.
092078c2 3.\"
e0779a71 4.\" %sccs.include.redist.man%
14955f05 5.\"
e0779a71 6.\" @(#)badsect.8 6.3 (Berkeley) %G%
092078c2 7.\"
036e6143 8.TH BADSECT 8 ""
092078c2
KM
9.UC 4
10.SH NAME
11badsect \- create files to contain bad sectors
12.SH SYNOPSIS
13.B /etc/badsect
c7d258c2 14bbdir sector ...
092078c2
KM
15.SH DESCRIPTION
16.I Badsect
17makes a file to contain a bad sector. Normally, bad sectors
18are made inaccessible by the standard formatter, which provides
19a forwarding table for bad sectors to the driver; see
20.IR bad144 (8)
21for details.
22If a driver supports the bad blocking standard it is much preferable to
23use that method to isolate bad blocks, since the bad block forwarding
24makes the pack appear perfect, and such packs can then be copied with
c7d258c2 25.IR dd (1).
092078c2
KM
26The technique used by this program is also less general than
27bad block forwarding, as
28.I badsect
29can't make amends for
30bad blocks in the i-list of file systems or in swap areas.
31.PP
c7d258c2
KM
32On some disks,
33adding a sector which is suddenly bad to the bad sector table
34currently requires the running of the standard DEC formatter.
35Thus to deal with a newly bad block
092078c2
KM
36or on disks where the drivers
37do not support the bad-blocking standard
38.I badsect
c7d258c2 39may be used to good effect.
092078c2
KM
40.PP
41.I Badsect
42is used on a quiet file system in the following way:
43First mount the file system, and change to its root directory.
c7d258c2
KM
44Make a directory BAD there. Run
45.I badsect
46giving as argument the BAD directory followed by
47all the bad sectors you wish to add.
48(The sector numbers must be relative to the beginning of
49the file system, but this is not hard as the system reports
50relative sector numbers in its console error messages.)
092078c2
KM
51Then change back to the root directory, unmount the file system
52and run
53.IR fsck (8)
54on the file system. The bad sectors should show up in two files
55or in the bad sector files and the free list. Have
56.I fsck
57remove files containing the offending bad sectors, but
58.B "do not"
59have it remove the BAD/\fInnnnn\fR files.
60This will leave the bad sectors in only the BAD files.
61.PP
62.I Badsect
63works by giving the specified sector numbers in a
64.IR mknod (2)
65system call,
c7d258c2 66creating an illegal file whose first block address is the block containing
092078c2 67bad sector and whose name is the bad sector number.
c7d258c2
KM
68When it is discovered by
69.I fsck
70it will ask ``HOLD BAD BLOCK''?
71A positive response will cause
72.I fsck
73to convert the inode to a regular file containing the bad block.
092078c2 74.SH SEE ALSO
c7d258c2
KM
75bad144(8),
76fsck(8),
77format(8V)
78.SH DIAGNOSTICS
79.I Badsect
80refuses to attach a block that
81resides in a critical area or is out of range of the file system.
82A warning is issued if the block is already in use.
092078c2 83.SH BUGS
c7d258c2 84If more than one sector which comprise a file system fragment are bad,
092078c2
KM
85you should specify only one of them to
86.I badsect,
c7d258c2
KM
87as the blocks in the bad sector files actually cover all the sectors in a
88file system fragment.