kernel reorg
[unix-history] / usr / src / sbin / badsect / badsect.8
... / ...
CommitLineData
1.\" Copyright (c) 1985 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\" @(#)badsect.8 6.3 (Berkeley) %G%
7.\"
8.TH BADSECT 8 ""
9.UC 4
10.SH NAME
11badsect \- create files to contain bad sectors
12.SH SYNOPSIS
13.B /etc/badsect
14bbdir sector ...
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
25.IR dd (1).
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
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
36or on disks where the drivers
37do not support the bad-blocking standard
38.I badsect
39may be used to good effect.
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.
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.)
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,
66creating an illegal file whose first block address is the block containing
67bad sector and whose name is the bad sector number.
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.
74.SH SEE ALSO
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.
83.SH BUGS
84If more than one sector which comprise a file system fragment are bad,
85you should specify only one of them to
86.I badsect,
87as the blocks in the bad sector files actually cover all the sectors in a
88file system fragment.