]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sbin/badsect/badsect.8
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sbin / badsect / badsect.8
1 .\" Copyright (c) 1985, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 4. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)badsect.8   8.1 (Berkeley) 6/5/93
29 .\" $FreeBSD$
30 .\"
31 .Dd June 5, 1993
32 .Dt BADSECT 8
33 .Os
34 .Sh NAME
35 .Nm badsect
36 .Nd create files to contain bad sectors
37 .Sh SYNOPSIS
38 .Nm
39 .Ar bbdir sector ...
40 .Sh DESCRIPTION
41 The
42 .Nm
43 utility makes a file to contain a bad sector.
44 Normally, bad sectors
45 are made inaccessible by the standard formatter, which provides
46 a forwarding table for bad sectors to the driver.
47 If a driver supports the bad blocking standard it is much preferable to
48 use that method to isolate bad blocks, since the bad block forwarding
49 makes the pack appear perfect, and such packs can then be copied with
50 .Xr dd 1 .
51 The technique used by this program is also less general than
52 bad block forwarding, as
53 .Nm
54 cannot make amends for
55 bad blocks in the i-list of file systems or in swap areas.
56 .Pp
57 On some disks,
58 adding a sector which is suddenly bad to the bad sector table
59 currently requires the running of the standard
60 .Tn DEC
61 formatter.
62 Thus to deal with a newly bad block
63 or on disks where the drivers
64 do not support the bad-blocking standard
65 .Nm
66 may be used to good effect.
67 .Pp
68 The
69 .Nm
70 utility is used on a quiet file system in the following way:
71 First mount the file system, and change to its root directory.
72 Make a directory
73 .Li BAD
74 there.
75 Run
76 .Nm
77 giving as argument the
78 .Ar BAD
79 directory followed by
80 all the bad sectors you wish to add.
81 (The sector numbers must be relative to the beginning of
82 the file system, but this is not hard as the system reports
83 relative sector numbers in its console error messages.)
84 Then change back to the root directory, unmount the file system
85 and run
86 .Xr fsck 8
87 on the file system.
88 The bad sectors should show up in two files
89 or in the bad sector files and the free list.
90 Have
91 .Xr fsck 8
92 remove files containing the offending bad sectors, but
93 .Em do not
94 have it remove the
95 .Pa BAD/ Ns Em nnnnn
96 files.
97 This will leave the bad sectors in only the
98 .Li BAD
99 files.
100 .Pp
101 The
102 .Nm
103 utility works by giving the specified sector numbers in a
104 .Xr mknod 2
105 system call,
106 creating an illegal file whose first block address is the block containing
107 bad sector and whose name is the bad sector number.
108 When it is discovered by
109 .Xr fsck 8
110 it will ask
111 .Dq Li "HOLD BAD BLOCK \&?" .
112 A positive response will cause
113 .Xr fsck 8
114 to convert the inode to a regular file containing the bad block.
115 .Sh DIAGNOSTICS
116 The
117 .Nm
118 utility refuses to attach a block that
119 resides in a critical area or is out of range of the file system.
120 A warning is issued if the block is already in use.
121 .Sh SEE ALSO
122 .Xr fsck 8
123 .Sh HISTORY
124 The
125 .Nm
126 utility appeared in
127 .Bx 4.1 .
128 .Sh BUGS
129 If more than one sector which comprise a file system fragment are bad,
130 you should specify only one of them to
131 .Nm ,
132 as the blocks in the bad sector files actually cover all the sectors in a
133 file system fragment.