Thursday, December 15, 2016

Cromemco MFM Hard Disk Formatting


Subtitle: How long does it take Marcus to format a hard Disk?

Answer: About 1 day :-)

At first my answer to Agata about the formatting time of 1 day, or about 8 hours of Marcus' life would seem to be quite high, especially since the disk is only going to be 91MB in size, post formatting.

Presumably though this is exactly the point.

This is the disk:

Yes this disk however is now over 30 years old and it is somewhat of a miracle that it is still working electrically or mechanically, or that there is a computer that can use it, or a person that knows how to use it well.

And the capacity of just under 100MB is 500 times smaller than the storage card in my mobile phone.  Oh mi, how things have moved on since the 80's



The following worked example of a disk format using Cromemco Cromix 167 my Operating System of choice in about 1981.  Oh, and still my Cromemco Operating System of choice in 2016.


Using inithard with parameter -n it means don't read the existing partition table from the head of the disk and instead prompt the user for the geometry.  At the end of the format the partition table parameters are written to a special place at the front of the disk.

Unlike with today's hard disks there is no mechanism for the host to equire about geometry, power on hours that primarily the SMART standard has made so easily possible today

First pass formatting produces errors.

Using the Cromemco STDC and STDX hard disk controllers the data track is not split into conventional sectors.  Instead a single read and write track command is used to write the 10K bytes contained on the surface.  The STDC controller then buffers the output reads and writes back to the operating system in a more manageable fashion.

This does mean that if any part of a track surface is faulty then the whole track is marked as unreadable.  In a more conventional schema of the time the track is divided into sectors and individual sectors are remapped if erroneous.


Although the disk starts from Cylinder 0 from Cromemco Cromix (cf Cromemco UNIX) the usable starting cylinder of the disk is always given to be 1

When you first format the whole disk the formatter checks for errors.  What you typically do then is make a first list of all the erroneous  surfaces.  You are then going to remap those error surfaces to an alternate track table.

Example: Your disk contains 1000 tracks from 0-999.  And there are 6 heads so meaning head 0 thru 5. You allocate the data part to be between 1-990 and leave 991-999 for bad track alternative mapping.

Whilst formatting you find track 146 surface 5 (head 5) has an issue.  So you relocate this to track 990 head 0.  So then when the Operating system tries to ready 146 surface 5 it gets remapped to track 990 head 0.


Whilst you can allocate an entire disk into a single partition you can split it into more than one partition as shown above.  You can then boot any partition from cold or whilst booted to a partition mount other partitions as you wish.

There is no 4 partition limit here as was imposed in later PC Operating System.

The partition allocation takes place after the formatting, though you can in fact just make partitions and do no formatting, if for example that you did it earlier.

The diskinfo command can show you the result of your formatting, partition allocation and bad track relocation. This simply reads the special area in track 0 and decodes it for display.



The readall command is the fastest way to read the entire disk and check it for any error
As a paranoid android lets read the whole disk 4 times, and time the event


As you can see this takes over 40 minutes!

It is good practice to do this for these 35 year plus old disks (!!) so we can be sure that no 'extra' read errors crop up after the disk has been spinning for a few hours.  Again, with media of this age, who design life was no doubt about 5 years, but is now over 35 years old, one has to be a little bit more careful.

Cromemco Cromix also provided a special rcopy command that would copy especially quickly from block devices, for example hard disks.  So back in the day it was good practice to have pairs of hard drives.  You could use the rcopy command to make a bit for bit copy from source to target hard disk.  If the source disk should fail simply boot from target and repair source.

Today this practice lives on in the UNIX and Linux community using the dd command to copy disks, although metadata on hard disks can make this a bad idea.

So here is the disk information showing all the partitions and alternate tracks  With the disk up and spinning for a couple of hours checking that no extra errors have sprung up.


One of the last steps is to make a filesystem that can contain files and directories.  In the days of Cromix there was only the Cromix filesystem  cf today when Windows offers FAT, NTFS and ReFS, and Linux offers more than 20 different filesystems.  Back in 1981 you only got a choice of 1 for Cromix  (and 1 for it even older CDOS) Operating System.


Here I made all the filesystems and finally mounted uo the the /dev/std32 partition up onto the filesystem blank /hd32.  Then using the cptree command I would copy the entire existing Operating System from / to the target /hd32.


Summary
I hope that I have shown why formatting a single disk on my 1980's Cromemco Cromix computer system can take the best part of the day.  Well to do it professionally and in an error free manner, given that this ancient media can now have significant defects which must be detected and then remapped.