(click pentru Romana)
hawk.ro / stories / ST-225 reading - part 2

ST-225 reading - part 2

Click here for first part

The program (rawhdd)

While there might be computers that are capable of:

I do not have one. However, in most cases, the drive can be read using BIOS calls under DOS. For this, I wrote "rawhdd".

Get it here. Compile with Borland's Turbo C (under DOS). It's available free from Embarcadero (registration required).


rawhdd [-d=drive] [-c=cylinders] [-h=heads] [-s=sectors] <dst_file>
The only required parameter is dst_file: destination file (use 8.3 naming!). Optional arguments are: Drive geometry is read from BIOS but can be overriden by c,h,s parameters.

Be advised that dst_file will be overwritten if it exists. Rawhdd also creates (or appends to, if it already exists) a file called rawhdd.log that will contain a text log of the reads (similar to what is output on screen).

Before starting operation, rawhdd will present the geometry it will use (either detected or entered from command line) as well as destination file and offer a chance to quit.

To read it

Prerequisites: HDD can be read using BIOS, the computer is capable of booting DOS and being connected to a LAN. I'm also assuming some familiarity with the DOS environment on the part of the reader.
My usual approach uses a Novell Netware server (I'm quite confortable with it) but it is possible to use a Linux computer as fileserver, using EtherDFS. On the client it only requires a packet driver and a small TSR. EtherDFS has, though, a slight problem: it hangs on certain operations (such as running TCC - Turbo C Compiler). However, rawhdd works fine under it.

Rawhdd executable can be copied either to the shared filesystem (Novell, DFS or anything else) or to diskette. Boot the computer from diskette and map the server to an unused drive letter. Of course, the shared filesystem needs enough free space to fit the HDD image, but since we are talking about MFM drives, that shouldn't be a problem.

Switch to the target (i.e. network) drive and run rawhdd.

H:\HOME\HAWK\WORK\C>rawhdd test.hdd
HDD Imaging program. Checking HDD...
WARNING: BIOS table cyls: 615; INT 13h,8 cyls: 613
Will read: 615 cylinders, 4 heads, 17 sectors
Will write to: test.hdd
Possible geometry mismatch (see warning above)
Proceed at your own risk!
Press ENTER to continue or any other key to abort
CH 0,1 OK
CH 0,2 OK
CH 0,3 OK
CH 1,0 OK
CH 1,1 OK
CH 1,2 OK
CH 1,3 OK
CH 2,0 OK
CH 613,2 OK
CH 613,3 OK
CH 614,0 OK
CH 614,1 OK
CH 614,2 OK
CH 614,3 OK


Example run under (Netware connected) qemu

It can happen that the "disk parameter table" (DPT) and INT 13h,8 BIOS call give different geometries. The program will use DPT values (and give a warning), but one can override the geometry with command line arguments. I remember reading somewhere (but can't find the reference) that a difference of 1 cylinder (or, in rare cases, 2) between these values is to be expected and in that case the DPT value is the one to use. And that's just what happens here: on the real machine the difference is 1 and rawhdd doesn't complain, but uses DPT value. Under qemu, the difference is bigger (2 cylinders), thus the warning.

Update 2021-01-04: Thanks to Zir Blazer in a comment on yet another virtuallyfun challenge, I now have a reference regarding for the cylinder difference between DPT and INT 13h,8: Ralf Brown's Interrupt List:

The maximum cylinder number reported in CX is usually two less than the total cylinder count reported in the fixed disk parameter table (see INT 41h,INT 46h) because early hard disks used the last cylinder for testing purposes.

Shake it!

A short movie showing the read operation and aforementioned "rocking". Stars represent errors (followed by retries), dots represent sectors read, CH n,m OK means whole track n (head m) was read without error.

Click to see the video at vimeo

Published 2019-03-09 by Mihai Gaitos - contacthawk.ro