[comp.sys.mac.programmer] Building a SCSI disk

nasser@forbrk.UUCP (Nasser Lone) (05/19/88)

Sometime ago, I posted a query about putting together a SCSI drive for
the Macintosh.  I have been working with SCSI drives on our UNIX box
where we have a generic SCSI driver.  This driver conforms to the SCSI
specifications and works with several different embedded SCSI drives.
SCSI is nice in that it provides a generic format command so that the
software does not have to worry about drive parameters such as number of
heads, number of cylinders, etc.  The only parameter that should be
provided is the block size.  There is also a read capacity command that
can be used to find out the number of blocks on the drive.  So, I
thought that it should be simple to do all this in the Mac world.

Based on what I have learned since my original posting, I still think
that it should not be too hard to write general software that would be
able to do all that is necessary, but it has not been done yet.  It
seems to me that most of what has been done has built-in dependencies, so
that the driver from one manufacturer will probably not work with a drive
from another.

One thing to remember is that the Macintosh operating system does not
include a driver for SCSI hard disks.  It includes a SCSI manager that
can be used to communicate with SCSI devices, but the driver itself is
placed on the drive from where it is loaded into the system at boot time.
So anybody trying to build a drive has to write this driver (or modify
an existing one).  Another piece of software needed is what is referred
to as the formatter-installer.  This software issues the low-level format
command to the drive, places the necessary information in blocks 0 and 1
on the drive, and puts the driver on the drive.  Thus the following steps
take place in the process of building the drive:
	1.  Format the drive (through the SCSI format command).
	2.  Build block 0 (info about capacity, block size, driver, etc).
	3.  Build block 1 (disk partition info).
	4.  Place the driver on the disk.

There are many sources of help available.  I am listing below some that
I have come across or that I have been told about.
	-  Inside Macintosh Vol. IV -- chapter on SCSI.
	-  Macintosh Tech Note 96.
	-  Macintosh Tech Note 159 -- the purpose of this note seems to
           be to discourage people from building SCSI drives.  I think it
           is too negative for people who know about SCSI.
	-  BMUG Fall 86 Newletter -- Building Your Own Hard Disk by Tim
           Standing.  I was told that the author did not finish his
           project.
	-  SCSI Tools disk from APDA (Apple Professional Developers
	   Assoc.).  This disk contains a sample driver for the SCSI
           disk.
	-  The FS&I program from Ephraim Vishniac.  This shareware
	   program will prepare the hard disk and write a driver to it.
           I used this program successfully on a drive; more on that
           later.
	-  Several people mentioned articles in MacTutor but I have not
           seen those.

In terms of hardware, one needs the following:
	1.  A case.
	2.  Power supply.  I have been told that one should use a
	    switching power supply for this purpose.  Make sure that the
            power supply can provide enough juice for the drive (and
            controller if you are using one).
	3.  The drive.
	4.  A controller card if you are not using an embedded SCSI
	    drive.
	5.  Cable from Mac DB25 port to Centronics 50-pin.  These are
	    widely available in the Bay Area (Fry's, MAC in Berkeley).
	6.  Cable from 50-pin Centronics to 50-pin socket connector on
            the drive (easy to build one).

I have done some experimentation so far.  I hooked up a drive to the Mac
using some adhoc connectors and used Vishniac's FS&I program.  I was able
to format a drive and subsequently boot from it.  However, I could not
get the program to work with a CDC Wren III drive.  My co-worker was told
by Dave Platt at Coherent Thought that FS&I and CDC Wren III are
incompatible, something I do not understand.  To use the FS&I program,
you have to manipulate resources using ResEdit.  You also have to know
some things about the drive.  One complaint I had about the program is
that it does all steps of formatting and initializing in one sequence.  I
think such a program should consist of three independent parts:
	-   Format and build block 0.
	-   Manipulate partition info.
	-   Place the driver on the disk.
Also, it seems that the driver that is part of this program does not
support multiple-partitions.


Following are the responses that I got to my query.  My thanks to all the
people who took the time to help a fellow netter.


Nasser		...!pacbell!forbrk!nasser

****************************************************************************

From: sun!coherent!dplatt (Dave Platt)
Organization: Coherent Thought Inc., Palo Alto CA

I'd recommend looking in the back of any of the popular electronics
magazines, PC Shopper, and so forth... lots of ads for hardware, power
supplies, cases, and so forth.  The simplest approach (although neither
the cheapest nor the smallest) would be to buy a case and power-supply
designed for a PC-clone, and install the disk in it.
 
If you buy a disk and controller that matches one of the combinations used
by Apple, you could probably use HD SCSI Setup (or whatever it's called) to
format and drive the disk.

A more general approach would be to use Ephraim Vishniac's SCSI Formatter
and Installer package... it's shareware, includes two sample drivers (one
for blind I/O and one for synchronized I/O), and is very flexible and
easy to configure.  The shareware fee is a pint of blood, donated to your
local Red Cross (or a cash donation).  SCSI F&I is available for anonymous
FTP on SUMEX;  if you don't have FTP access and can't find a copy locally,
let me know and I'll arrange to get you a copy.
 
Hacking a SCSI interface is not a task for the timid nor the
unlearned!
 
Be warned that some drives (e.g. the newer CDC Wrens) will not work with the
Mac Plus SCSI port... the Plus has a relatively buggy implementation.  There
are some Apple tech notes relating to the SCSI port on the Plus;  let me know
if you'd like me to dig 'em up for you.

You may find that the cost of putting together an effective SCSI drive
may not be significantly less than the cost of buying a low-end drive of
similar capabilities... once you add in the single-unit cost of a case,
power supply, cable, and so forth.  Perhaps buying an external (or internal)
drive from an existing manufacturer would be a better solution... only
you can decide.
 
****************************************************************************

From: Juri Munkki <lll-tis!lll-crg!uunet!santra.hut.fi!jmunkki>
Organization: Helsinki University of Technology, Finland

I recomment the Seagate ST277N. It is a 40 ms, 64 MB half height 5.25" drive
with a built-in intelligent SCSI controller. It is relatively cheap.

Try the CMS software, if you don't mind using commercial software.
Ephraim Vishniac's generic SCSI also works, but it has some problems.
You might have to use Vishniac's formatter before the CMS formatter
(I don't know why this it is this way. The CMS 60 is an ST277N).

Get yourself the Apple SCSI developers package and all the MacTutor
back-issues that have SCSI drivers. It isn't nearly impossible to
write one from scratch. Using the MacTutor examples it might be almost
easy.

****************************************************************************

From: ames!uw-beaver!camco!happym!irv
Organization: Happy Man Corp.

I'm interested in hearing of what you learn.  Thanks!

****************************************************************************

From: noao!naucse!pab%arizona.UUCP@ncar.UCAR.EDU (Paul Balyoz)

Carl Nelson and Associates in Seattle Wa. ,now called Software
Architects, is selling their driver which several major hard drive
vendors sell under their own label. I think their looking for $50, 
and the installer software is very good. The address is:

****************************************************************************

From: lll-tis!ames!im4u!rolex!twb (Tom Bereiter)

About your question on the net concerning SCSI disks:  Software-wise the best
thing you can do is to get hold of a copy of a shareware package designed
expressly for attaching alien disks.  It's called something like "SCSI
formatter" and is posted on the info-mac archives at sumex.standford.edu.
You just edit some templates with ResEdit and end up with a custom formatter/
installer.  If you have trouble finding it let me know and I'll post it to 
the net--seeing as this question comes up every few months.

****************************************************************************

From: ames!lll-lcc!csustan!psivax.psi.siemens.COM!rabbit
Organization: Pacesetter Systems Inc., Sylmar, CA

I built my own with the following:
	MD01 Emulex SCSI controller (to ST506 drives)
	Maxtor 85 meg drive
	PC clone cabinet and power supply
	cables - Apple's SCSI cable (DB25 to 50 pin centronics)
		 50 pin centronics to 50 pin SCSI connector (I
		 forget what those are called; the 2 row of 25
		 pins on the controller) using flat ribbon cable

I used the Emulex controller because that was the one that I had
on my UNIX system before I got another hard disk with a built in
controller.  The Emulex controller goes for $200 or so I think (not
cheap) and can handle 2 hard disks (though the software driver
doesn't know how to use it).  If I had to start from scratch, I'd
probably get the Adaptec controller for $100 or so.

The Maxtor drive I got went for around $900 which is about the going
price at that time (within the $10/meg that I was looking at anyways).

PC clone cabinet - $35
power supply - $65 (I think it was a 150 watt supply; more than enough
	for the drive and controller; I'm not sure if a cheapie 65
	watt one would have worked but I'm possibly thinking of putting
	another drive in there)
	[at least there's one good thing about PC clones... cheap
	 hardware; you can buy a single hard disk cabinet and power
	 supply and it will cost more than the clone stuff; though
	 the clone stuff is bigger than you'd need for bare bones;
	 I just set my clone case on its side]

I'm currently trying to implement Apple's SCSI driver to
work with my system.  IM Vol 4 and 5 gives details of what's required.
Also, MacTutor had a few articles about how to do this.  Check the
Jan 88 issue of MacTutor for details on modifying Apple's driver.  There's
also a few public domain drivers out there but I don't know of any.  You
should also look at Apple's Tech notes on SCSI information if you're
starting from scratch.

****************************************************************************

From: jgh@atom.oz.au (John G. Haub)

Dear Nasser,

	It's good to see that I'm not the only fool contemplating such
a project. Here in Oz hard disks are still very expensive >= $A1500. So it
appears an attractive project.

	In my case I've probably narrowed my requirements down a little 
but still I would be very grateful to hear about any information that you might
receive. I intend using two Epson 20Mb winchesters, which I understand are a 
fairly generic hard disk although not one of the more recognised brands such
Segate (the reason being I got them at the right price).

	I've read the Feb '87 Mactutor article 'build your own SCSI hard disk'
by Tim Standing and have spoken to a few people here in Oz and believe that
just about any SCSI controller will do however I'v been informed that the
real problem(s) is to develop software for formating the disk and installing
a SCSI driver which will work with the appropriate controller. Tim published
the software for the device that he built and I have a copy of that software.
So consequently I have been specifically chasing the controller that he used.
I've had very little luck here in Oz locating such a board, the one piece of
luck that I had proved to be prohibitively expensive (~$500 A). A friend of 
mine at Standford Uni over your way has found that Wyle Labs sell the 
appriate board for $156 US (much cheaper for me to import one) and he is
still chasing round for a lower price. The particular board that I am
interested in is Adaptec model ACB-4000A.

	As I said before, any information that you dig up would be greatly
appreciated down here in Oz.

****************************************************************************