|
|
Some weeks later, after restoring my system to a new 7200 rpm Utra-Wide SCSI disk I found time to work on my broken disk. I began by adding debugging messages to the scsi device driver section of the Linux kernel. I eventually came to understand that the problem was that some of the mode page settings had been overwritten with incorrect values. The scsi mode pages are stored on the disk in an area not used for data storage (usually on the first track). The complete SCSI-II draft standard specification describes the contents of the mode pages and the standards for accessing them.
Driver programs provide access to mode page information on a hard disk drive by implementing the MODE_SENSE ioctl operation. Some of the fields of the mode pages are writeable and can be written with the MODE_SELECT ioctl. Here is a table of the mode pages:
| Mode Page | Op-Code | SCSI Spec. Section |
|---|---|---|
| Control | 0Ah | 7.3.3.1 |
| Disconnect-Reconnect | 02h | 7.3.3.2 |
| Peripheral Device | 09h | 7.3.3.3 |
| Caching | 08h | 8.3.3.1 |
| Format Device | 03h | 8.3.3.3 |
| Notch and Partition | 0Ch | 8.3.3.5 |
| Error Recovery | 01h | 8.3.3.7 |
| Rigid Disk Geometry | 04h | 8.3.3.7 |
| Verify Error Recovery | 07h | 8.3.3.8 |
By adding debugging messages to my kernel I eventually found that the
bytes per sector entry in the Format Device page
of the broken drive had been changed to 2048 bytes instead of the
512 bytes that it should have been. Now I needed to change it back
and it was not too clear at the time exactly where to do this in
the kernel code. If I could have booted Linux then I could have
use a neat Linux program called
scsiinfo.
This tools dumps all sorts of information about a scsi device including
mode page settings and it will even let you change mode page settings.
Here's a
sample of the output from running
"scsiinfo -a /dev/sdb" on my machine.
But, alas, I could not boot Linux.
Fortunately I discovered an awesome Windows95 program called SCSI toolbox32. This program does alot of stuff related to SCSI devices including changing mode page settings. This is an expensive commercial product but a time limited full demo version is available from their site and that was all I needed to repair my disk.
Here's a summary of some of the useful links that I used in resurrecting my disk drive.