DISKDEFECT(8) BSD System Manager's Manual DISKDEFECT(8)NAMEdiskdefect - read/write standard bad sector information
SYNOPSISdiskdefect [-acnswvy] [-b bad-block-info] [-C copy-retries] [-g
geometry-label] [-t replacement-type] disk [disk-snum
[bad-block ...]]
DESCRIPTION
Diskdefect can be used to inspect and/or change the information stored on
a disk that is used by the disk drivers to implement bad sector forward-
ing. The diskdefect program is capable of using several different bad-
block formats. At present, however, only the bad144(5) format and a spe-
cial type called ``null'' are supported. The null format is never stored
on disk, and can be used to run a simple reliability scan.
Available options:
-a The argument list (and the results of the disk scan if the -s or
-w options were given) are new bad sectors to be added to an ex-
isting bad-block table. The new replacement sectors will be
filled with zero bytes unless the -c or -C flags are used.
If invoked without the -a option diskdefect will overwrite the
existing bad-block table and you must specify a new disk serial
number to be stored with the bad-block table.
-b bad-block-info
Controls how the bad block map is handled.
For the bad144 format, bad-block-info may be a digit in 0 through
4; this specifies which copy of the bad block information to use.
Only that copy is loaded and updated. The default is to search
for a good header, and to update all the copies.
-c Forces an attempt to copy the old sector to the replacement.
This may be useful when replacing an unreliable sector. Ten at-
tempts will be made to read the original data.
-C copy-retries
Similar to -c, but allows the number of retries to be specified.
-g geometry-label
Allows diskdefect to proceed on an unlabeled disk. Rather than
reading the disk geometry from the pack label, diskdefect will
use the specified type from disktab(5).
-t replacement-type
Tells diskdefect to use the specified type of bad block replace-
ment. By default, diskdefect will choose the correct type for
the disk, but if desired, the default type can be overridden.
Note that this has no effect on the underlying driver; using the
wrong type of bad block replacement is not likely to do anything
useful. Thus, -t really exists only to set the null replacement
type.
-n Disables writing the bad-block table to disk (no write mode).
This option is like the -n option to the make(1) and sh(1) pro-
grams. This is independent of the -w option.
-s Scans the disk and collects sectors that could not be read (or
with the -w option, written). With the -v (verbose) option, -s
will print a cylinder map with periods (.) for good cylinders and
x's for bad cylinders and at the end will print a bad-block sum-
mary containing the logical sector number, cylinder, head, and
sector of the error. When scanning sector by sector it spins the
sequence '/', '-', '\', '|'.
-w Like -s, but rewrites each cylinder after reading it. (This
tests the disk a little more thoroughly.)
WARNING: Use -w with caution and only on idle disks. Between
reading data and writing it back out the system may have changed
it.
-v The entire process is described as it happens in gory detail if
-v (verbose) is given.
-y Don't ask any questions (assumes yes).
The diskdefect program is invoked by giving a device name (e.g. wd0, wd1,
etc.). With no optional arguments it reads the current defect list of
the corresponding disk and prints out the bad sector information. It is-
sues a warning if the list is out of order. The diskdefect program may
also be invoked with a serial number for the pack and a list of bad sec-
tors. It will write the supplied information into all copies of the bad-
sector file, replacing any previous information. Note, however, that
diskdefect does not arrange for the specified sectors to be marked bad in
this case. This procedure should only be used to restore known bad sec-
tor information which was destroyed.
It is no longer necessary to reboot to allow the kernel to reread the
bad-sector table from the drive.
EXAMPLESdiskdefect-swcv wd0 12345678
Initialize the bad-block table to the result of the scan (erase
any existing bad-block information). Set the disk serial number
to 12345678. Attempt to copy the old data to the replacement
sectors, if that fails zero the replacement sector.
diskdefect-a -swcv wd0
Scan the disk (read and write) and add any new bad sectors the
the existing bad-block table. Attempt to copy the old data to
the replacement sectors, if that fails zero the replacement sec-
tor.
SEE ALSObad144(5), disktab(5), badsect(8)BUGS
It should be possible to format disks on-line under BSD.
It should be possible to mark bad sectors on drives of all types.
More thorough (but destructive) ``worst case pattern'' writes should be
available.
HISTORY
The diskdefect command appeared in 4.1BSD as bad144(8). It has been
merged with drck(8) at BSDI, and the name changed to be more intuitive
and otherwise protect the innocent.
4th Berkeley Distribution March 16, 1991 2