[comp.sys.atari.st] Formatting using a bad block list

hcj@lzaz.ATT.COM (HC Johnson) (10/11/89)

This is the README from my format.arc.  Send mail, and I'll mail
it to you.
------------------------

Here are two programs:
minihdx; used to format using a industry bad block list.
mkfs;    used to partition, and build GEM file systems.

MINIHDX

Usage:

	minihdx.ttp

	minihdx SCSI LUN badfile "FORMAT"
where;
	SCSI is the SCSI number (0-7).
	LUN  is the logical unit.  If there is only one drive, it is 0.
	badfile is a file of important parameters and the bad list.
	FORMAT  is a keyword that if omitted will prevent actual formatting.

The badfile is structured as follows.  I have used parameters from my drive
as an example.

------ bad file follows -----
#			THESE ARE MY COMMENTS, NOT in file.
#			------------------------------------
# my list		any line starting with # is a comment
SERIALNO=188885		this is an ascii string
INTERLEAVE=1		my Adaptec 4000 recommends using 1.
CYLINDERS=511		number of cylinders.
HEADS=9			number of heads.
REDUCEDWRITE=511	if the drive requires 'reduced write' put the cylinder
#			otherwise, set = to CYLINDERS
LANDING=4		where your drive should settle when parked.
STEPRATE=2		0, 1, or 2.  0=3ms,st506; 1=28us,st412; 2=12us
SECTORS=17		Adaptec 4000 is 17 is interleave is 1, 16 otherwise.
#			MFM 16/17 RLL is 25 ?
#			The format of a badlist CYL<tab>HEAD<tab>BIT_POSITION
#			The BADLIST MUST increase monotonically!!!
BADLIST:		the list of bad bits areas follows to the end of file
26	8	8521	cylindar 26, head 8, bit position 8521
485	8	9454
493	3	8633
496	7	8012
=====================end of badfile==============

The Adaptec controllers have a cleaver scheme of handling bad spots on the disk.
When the bad list is passed to the controller during formatting, it removes the
sectors containing the areas so that the disk appears to be a linear sequence
of good sectors; only a few appear missing at the end.

The bad list may contain at most 127 entries.

After formatting, I attempt to find out how many good sectors are on the disk.
This is approximatly, TOTAL minus the number of bad spots.  Somtimes a bad
spot will cost 2 sectors, sometimes none.  The SCSI command to read the size
can only be issued on BMS-200 controllers.  It fails on others.  If this
happens, then I use the approximate value.

Next, I write sector 0.  This contains the following:
a. It is cleared to 0.
b. At the beginning is a simple program to stop disk booting should the checksum
   be set to 1234.
c. Hd_size, the size of the disk is set to the number of good sectors.
d. Other miscellaneous parameters are set.
e. Sector 1 is reserved for the Bad Sector List (BSL).  This sector is cleared.
f. The number of Bad Sectors is set to 0.

Note:  The BSL is an ATARI invention and does not need to know about the sectors
	lost in the bad list.

Sample:
	minihdx 1 0 badfile FORMAT
to format SCSI 1, LUN 0, using badfile for parameters.
	minihdx 1 0 badfile NO
will omit the formatting, but write sectors 0 and 1.


MKFS

Mkfs is used to partition and build TOS File systems.  I had intended to
use either the Supra or HDX301 'formatter' to partition the drive.  My Supra
software seems to want to format first, loosing my bad sector mapping.
HDX301 is nuts.  It requires using the BSL and other gunk.  Additionally,
after formatting, it does a bad sector scan, and screws up on my large drives.

I wrote this as a result.  I have decided not to use the Atari HDX301 scheme
for handling over 4 partitions.  I use PC-Ditto and Spectre-128, and both
of these expect the Supra Partitioning scheme.  The Supra software is readily
available and can be used to boot the hard disk and keep 12 partitions.

TOS1.4 will handle a full  32 Megabyte file system; but writes are S L O W!
This large a file system needs a FAT cache.  I did not support ATARI's 
really wild scheme of getting gigabytes by changing the sector size.
Why couldn't they just change the Cluster Size, like IBM.  Anyway, if the
sector size is changed I can't use Norton utilities and PC-ditto on those
partitions.

Mkfs has no parameters.  It prompts for all parameters, and suggests reasonable
defaults.  After the SCSI and LUN are entered it reads sector 0 and prints
the current partition table.  If the drive has just been formatted this area
will be cleared to 0.  Mkfs is usable on any drive.  If that drive does not
use Supra partitioning, partitions 4-11 may print a invalid numbers.  Just
ignore them and change only partions 0-3.
Partitions for Minix (MIX) and Spectre-128 can be allocated as well.
---------

Howard C. Johnson
ATT Bell Labs
att!lzaz!hcj
hcj@lzaz.att.com