xref: /original-bsd/sbin/badsect/badsect.8 (revision c3e32dec)
1.\" Copyright (c) 1985, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)badsect.8	8.1 (Berkeley) 06/05/93
7.\"
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
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
22.Xr bad144 8
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
27.Xr dd 1 .
28The technique used by this program is also less general than
29bad block forwarding, as
30.Nm badsect
31can't make amends for
32bad blocks in the i-list of file systems or in swap areas.
33.Pp
34On some disks,
35adding a sector which is suddenly bad to the bad sector table
36currently requires the running of the standard
37.Tn DEC
38formatter.
39Thus to deal with a newly bad block
40or on disks where the drivers
41do not support the bad-blocking standard
42.Nm badsect
43may be used to good effect.
44.Pp
45.Nm Badsect
46is used on a quiet file system in the following way:
47First mount the file system, and change to its root directory.
48Make a directory
49.Li BAD
50there.  Run
51.Nm badsect
52giving as argument the
53.Ar BAD
54directory followed by
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.)
59Then change back to the root directory, unmount the file system
60and run
61.Xr fsck 8
62on the file system.  The bad sectors should show up in two files
63or in the bad sector files and the free list.  Have
64.Xr fsck
65remove files containing the offending bad sectors, but
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
75works by giving the specified sector numbers in a
76.Xr mknod 2
77system call,
78creating an illegal file whose first block address is the block containing
79bad sector and whose name is the bad sector number.
80When it is discovered by
81.Xr fsck
82it will ask
83.Dq Li "HOLD BAD BLOCK ?"
84A positive response will cause
85.Xr fsck
86to convert the inode to a regular file containing the bad block.
87.Sh SEE ALSO
88.Xr bad144 8 ,
89.Xr fsck 8 ,
90.Xr format 8
91.Sh DIAGNOSTICS
92.Nm Badsect
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.
96.Sh BUGS
97If more than one sector which comprise a file system fragment are bad,
98you should specify only one of them to
99.Nm badsect ,
100as the blocks in the bad sector files actually cover all the sectors in a
101file system fragment.
102.Sh HISTORY
103The
104.Nm
105command appeared in
106.Bx 4.1 .
107