| 1 | .\" Copyright (c) 1980 Regents of the University of California. |
| 2 | .\" All rights reserved. The Berkeley software License Agreement |
| 3 | .\" specifies the terms and conditions for redistribution. |
| 4 | .\" |
| 5 | .\" @(#)badsect.8 6.1 (Berkeley) %G% |
| 6 | .\" |
| 7 | .TH BADSECT 8 "" |
| 8 | .UC 4 |
| 9 | .SH NAME |
| 10 | badsect \- create files to contain bad sectors |
| 11 | .SH SYNOPSIS |
| 12 | .B /etc/badsect |
| 13 | bbdir sector ... |
| 14 | .SH DESCRIPTION |
| 15 | .I Badsect |
| 16 | makes a file to contain a bad sector. Normally, bad sectors |
| 17 | are made inaccessible by the standard formatter, which provides |
| 18 | a forwarding table for bad sectors to the driver; see |
| 19 | .IR bad144 (8) |
| 20 | for details. |
| 21 | If a driver supports the bad blocking standard it is much preferable to |
| 22 | use that method to isolate bad blocks, since the bad block forwarding |
| 23 | makes the pack appear perfect, and such packs can then be copied with |
| 24 | .IR dd (1). |
| 25 | The technique used by this program is also less general than |
| 26 | bad block forwarding, as |
| 27 | .I badsect |
| 28 | can't make amends for |
| 29 | bad blocks in the i-list of file systems or in swap areas. |
| 30 | .PP |
| 31 | On some disks, |
| 32 | adding a sector which is suddenly bad to the bad sector table |
| 33 | currently requires the running of the standard DEC formatter. |
| 34 | Thus to deal with a newly bad block |
| 35 | or on disks where the drivers |
| 36 | do not support the bad-blocking standard |
| 37 | .I badsect |
| 38 | may be used to good effect. |
| 39 | .PP |
| 40 | .I Badsect |
| 41 | is used on a quiet file system in the following way: |
| 42 | First mount the file system, and change to its root directory. |
| 43 | Make a directory BAD there. Run |
| 44 | .I badsect |
| 45 | giving as argument the BAD directory followed by |
| 46 | all the bad sectors you wish to add. |
| 47 | (The sector numbers must be relative to the beginning of |
| 48 | the file system, but this is not hard as the system reports |
| 49 | relative sector numbers in its console error messages.) |
| 50 | Then change back to the root directory, unmount the file system |
| 51 | and run |
| 52 | .IR fsck (8) |
| 53 | on the file system. The bad sectors should show up in two files |
| 54 | or in the bad sector files and the free list. Have |
| 55 | .I fsck |
| 56 | remove files containing the offending bad sectors, but |
| 57 | .B "do not" |
| 58 | have it remove the BAD/\fInnnnn\fR files. |
| 59 | This will leave the bad sectors in only the BAD files. |
| 60 | .PP |
| 61 | .I Badsect |
| 62 | works by giving the specified sector numbers in a |
| 63 | .IR mknod (2) |
| 64 | system call, |
| 65 | creating an illegal file whose first block address is the block containing |
| 66 | bad sector and whose name is the bad sector number. |
| 67 | When it is discovered by |
| 68 | .I fsck |
| 69 | it will ask ``HOLD BAD BLOCK''? |
| 70 | A positive response will cause |
| 71 | .I fsck |
| 72 | to convert the inode to a regular file containing the bad block. |
| 73 | .SH SEE ALSO |
| 74 | bad144(8), |
| 75 | fsck(8), |
| 76 | format(8V) |
| 77 | .SH DIAGNOSTICS |
| 78 | .I Badsect |
| 79 | refuses to attach a block that |
| 80 | resides in a critical area or is out of range of the file system. |
| 81 | A warning is issued if the block is already in use. |
| 82 | .SH BUGS |
| 83 | If more than one sector which comprise a file system fragment are bad, |
| 84 | you should specify only one of them to |
| 85 | .I badsect, |
| 86 | as the blocks in the bad sector files actually cover all the sectors in a |
| 87 | file system fragment. |