BSD 4_3_Reno release
[unix-history] / usr / src / sbin / badsect / badsect.8
CommitLineData
14955f05
KB
1.\" Copyright (c) 1985 The Regents of the University of California.
2.\" All rights reserved.
092078c2 3.\"
1c15e888
C
4.\" Redistribution and use in source and binary forms are permitted provided
5.\" that: (1) source distributions retain this entire copyright notice and
6.\" comment, and (2) distributions including binaries display the following
7.\" acknowledgement: ``This product includes software developed by the
8.\" University of California, Berkeley and its contributors'' in the
9.\" documentation or other materials provided with the distribution and in
10.\" all advertising materials mentioning features or use of this software.
11.\" Neither the name of the University nor the names of its contributors may
12.\" be used to endorse or promote products derived from this software without
13.\" specific prior written permission.
14.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14955f05 17.\"
1c15e888 18.\" @(#)badsect.8 6.3 (Berkeley) 6/24/90
092078c2 19.\"
1c15e888 20.TH BADSECT 8 "June 24, 1990"
092078c2
KM
21.UC 4
22.SH NAME
23badsect \- create files to contain bad sectors
24.SH SYNOPSIS
25.B /etc/badsect
c7d258c2 26bbdir sector ...
092078c2
KM
27.SH DESCRIPTION
28.I Badsect
29makes a file to contain a bad sector. Normally, bad sectors
30are made inaccessible by the standard formatter, which provides
31a forwarding table for bad sectors to the driver; see
32.IR bad144 (8)
33for details.
34If a driver supports the bad blocking standard it is much preferable to
35use that method to isolate bad blocks, since the bad block forwarding
36makes the pack appear perfect, and such packs can then be copied with
c7d258c2 37.IR dd (1).
092078c2
KM
38The technique used by this program is also less general than
39bad block forwarding, as
40.I badsect
41can't make amends for
42bad blocks in the i-list of file systems or in swap areas.
43.PP
c7d258c2
KM
44On some disks,
45adding a sector which is suddenly bad to the bad sector table
46currently requires the running of the standard DEC formatter.
47Thus to deal with a newly bad block
092078c2
KM
48or on disks where the drivers
49do not support the bad-blocking standard
50.I badsect
c7d258c2 51may be used to good effect.
092078c2
KM
52.PP
53.I Badsect
54is used on a quiet file system in the following way:
55First mount the file system, and change to its root directory.
c7d258c2
KM
56Make a directory BAD there. Run
57.I badsect
58giving as argument the BAD directory followed by
59all the bad sectors you wish to add.
60(The sector numbers must be relative to the beginning of
61the file system, but this is not hard as the system reports
62relative sector numbers in its console error messages.)
092078c2
KM
63Then change back to the root directory, unmount the file system
64and run
65.IR fsck (8)
66on the file system. The bad sectors should show up in two files
67or in the bad sector files and the free list. Have
68.I fsck
69remove files containing the offending bad sectors, but
70.B "do not"
71have it remove the BAD/\fInnnnn\fR files.
72This will leave the bad sectors in only the BAD files.
73.PP
74.I Badsect
75works by giving the specified sector numbers in a
76.IR mknod (2)
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
KM
80When it is discovered by
81.I fsck
82it will ask ``HOLD BAD BLOCK''?
83A positive response will cause
84.I fsck
85to convert the inode to a regular file containing the bad block.
092078c2 86.SH SEE ALSO
c7d258c2
KM
87bad144(8),
88fsck(8),
89format(8V)
90.SH DIAGNOSTICS
91.I Badsect
92refuses to attach a block that
93resides in a critical area or is out of range of the file system.
94A warning is issued if the block is already in use.
092078c2 95.SH BUGS
c7d258c2 96If more than one sector which comprise a file system fragment are bad,
092078c2
KM
97you should specify only one of them to
98.I badsect,
c7d258c2
KM
99as the blocks in the bad sector files actually cover all the sectors in a
100file system fragment.