Commit | Line | Data |
---|---|---|
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 |
19 | makes a file to contain a bad sector. Normally, bad sectors |
20 | are made inaccessible by the standard formatter, which provides | |
21 | a forwarding table for bad sectors to the driver; see | |
0fccfdb8 | 22 | .Xr bad144 8 |
092078c2 KM |
23 | for details. |
24 | If a driver supports the bad blocking standard it is much preferable to | |
25 | use that method to isolate bad blocks, since the bad block forwarding | |
26 | makes the pack appear perfect, and such packs can then be copied with | |
0fccfdb8 | 27 | .Xr dd 1 . |
092078c2 KM |
28 | The technique used by this program is also less general than |
29 | bad block forwarding, as | |
0fccfdb8 | 30 | .Nm badsect |
092078c2 KM |
31 | can't make amends for |
32 | bad blocks in the i-list of file systems or in swap areas. | |
0fccfdb8 | 33 | .Pp |
c7d258c2 KM |
34 | On some disks, |
35 | adding a sector which is suddenly bad to the bad sector table | |
0fccfdb8 CL |
36 | currently requires the running of the standard |
37 | .Tn DEC | |
38 | formatter. | |
c7d258c2 | 39 | Thus to deal with a newly bad block |
092078c2 KM |
40 | or on disks where the drivers |
41 | do not support the bad-blocking standard | |
0fccfdb8 | 42 | .Nm badsect |
c7d258c2 | 43 | may be used to good effect. |
0fccfdb8 CL |
44 | .Pp |
45 | .Nm Badsect | |
092078c2 KM |
46 | is used on a quiet file system in the following way: |
47 | First mount the file system, and change to its root directory. | |
0fccfdb8 CL |
48 | Make a directory |
49 | .Li BAD | |
50 | there. Run | |
51 | .Nm badsect | |
52 | giving as argument the | |
53 | .Ar BAD | |
54 | directory followed by | |
c7d258c2 KM |
55 | all the bad sectors you wish to add. |
56 | (The sector numbers must be relative to the beginning of | |
57 | the file system, but this is not hard as the system reports | |
58 | relative sector numbers in its console error messages.) | |
092078c2 KM |
59 | Then change back to the root directory, unmount the file system |
60 | and run | |
0fccfdb8 | 61 | .Xr fsck 8 |
092078c2 KM |
62 | on the file system. The bad sectors should show up in two files |
63 | or in the bad sector files and the free list. Have | |
0fccfdb8 | 64 | .Xr fsck |
092078c2 | 65 | remove files containing the offending bad sectors, but |
0fccfdb8 CL |
66 | .Em do not |
67 | have it remove the | |
68 | .Pa BAD/ Ns Em nnnnn | |
69 | files. | |
70 | This will leave the bad sectors in only the | |
71 | .Li BAD | |
72 | files. | |
73 | .Pp | |
74 | .Nm Badsect | |
092078c2 | 75 | works by giving the specified sector numbers in a |
0fccfdb8 | 76 | .Xr mknod 2 |
092078c2 | 77 | system call, |
c7d258c2 | 78 | creating an illegal file whose first block address is the block containing |
092078c2 | 79 | bad sector and whose name is the bad sector number. |
c7d258c2 | 80 | When it is discovered by |
0fccfdb8 CL |
81 | .Xr fsck |
82 | it will ask | |
83 | .Dq Li "HOLD BAD BLOCK ?" | |
c7d258c2 | 84 | A positive response will cause |
0fccfdb8 | 85 | .Xr fsck |
c7d258c2 | 86 | to 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 |
93 | refuses to attach a block that |
94 | resides in a critical area or is out of range of the file system. | |
95 | A warning is issued if the block is already in use. | |
0fccfdb8 | 96 | .Sh BUGS |
c7d258c2 | 97 | If more than one sector which comprise a file system fragment are bad, |
092078c2 | 98 | you should specify only one of them to |
0fccfdb8 | 99 | .Nm badsect , |
c7d258c2 KM |
100 | as the blocks in the bad sector files actually cover all the sectors in a |
101 | file system fragment. | |
0fccfdb8 CL |
102 | .Sh HISTORY |
103 | The | |
104 | .Nm | |
105 | command appeared in | |
106 | .Bx 4.1 . |