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