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