Date : Thu, 15 Jun 1989 12:35:29 PDT
From : Bridger Mitchell <bridger%rcc@rand.org>
Subject: verify on write
>>John Shin asked:
>>I was wondering if CP/M-80 had the write verify facility, and if it did,
>>if it can be turned on and off through BIOS or BDOS calls.
>>
>>MS-DOS certainly does (apologies to the "CP/M on steroids" person), but
>>the default is "off."
>>
>>It seems that the version of DISKCOPY I have has something like verify,
>>since it just picked out a bad track for me during formatting, but I
>>wanted to know if BDOS does it for ALL writing accesses. If it does,
>>also, what happens to the bad track? Ignored or marked?
The CP/M 2.2 (and CP/M+) BDOS does not have a verify-after-write
feature. There are a few BIOSes that implement one at the
physical-sector level, but it is not part of the standardized
BIOS-BDOS interface. For example, the stock Kaypro bios had a
"writesafe" flag which, when set, caused each written sector to be
read back. It was very badly implemented, however.
Good CP/M file copy utilities have an option to verify the integrity
of a file after writing. An efficient algorithm is to compute the CRC
during writing, close the file, open it and recompute the CRC by
reading it into a different buffer . (Different buffers should be used
in order to detect a *memory* error.) Such utilities will report
verification errors and pause or terminate.
The FINDBAD tool can then be run to non-destructively read disk
sectors, and lock-out bad blocks. It does this by creating a
directory entry (effectively a file, but it isn't written) that
contains the bad block numbers. While that entry (marked read-only)
is in the directory, the BDOS will not write to those blocks.
A very few BIOSes have provision for spare tracks on a hard disk,
and the capability of substituting a spare for a bad track. Switching
to a spare requires a special, BIOS-specific tool.
When bad sectors occur, you may be able to restore the disk to
full health with minimum grief if you can reformat *only* the
bad track. Unfortunately, few format tools have this option.
Lacking that, you can try reformatting the full disk -- first backing
up everything you can successfully access.
-- bridger mitchell