]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/doc/handbook/esdi.sgml
This commit was generated by cvs2svn to compensate for changes in r16359,
[FreeBSD/FreeBSD.git] / share / doc / handbook / esdi.sgml
1 <!-- $Id: esdi.sgml,v 1.6 1996/01/31 19:02:56 mpp Exp $ -->
2 <!-- The FreeBSD Documentation Project -->
3
4 <!--
5       <title>An introduction to ESDI hard disks and their use with FreeBSD</title>
6       <author>(c) 1995, Wilko Bulte, <tt/wilko@yedi.iaf.nl/
7       <date>Tue Sep 12 20:48:44 MET DST 1995</date>
8
9     Copyright 1995, Wilko C. Bulte, Arnhem, The Netherlands 
10
11       <abstract>
12         This document describes the use of ESDI disks in combination
13         with the FreeBSD operating system. Contrary to popular
14         belief, this is possible and people are using ESDI based
15         systems successfully! This document tries to explain you 
16         how to do this.
17
18         If you find something missing, plain wrong or have useful 
19         comments on how to improve
20         the document please send mail to <tt/wilko@yedi.iaf.nl/
21       </abstract>
22 -->
23
24     <sect1><heading>Using ESDI hard disks<label id="esdi"></heading>
25
26       <p><em>Copyright &copy; 1995, &a.wilko;.<newline>24 September 1995.</em>
27
28         ESDI is an acronym that means Enhanced Small Device Interface.
29         It is loosely based on the good old ST506/412 interface originally
30         devised by Seagate Technology, the makers of the first affordable
31         5.25" winchester disk.
32
33         The acronym says Enhanced, and rightly so. In the first place
34         the speed of the interface is higher, 10 or 15 Mbits/second 
35         instead of the 5 Mbits/second of ST412 interfaced drives.
36         Secondly some higher level commands are added, making the ESDI
37         interface somewhat 'smarter' to the operating system driver
38         writers. It is by no means as smart as SCSI by the way. ESDI
39         is standardized by ANSI.
40
41         Capacities of the drives are boosted by putting more sectors
42         on each track. Typical is 35 sectors per track, high capacity
43         drives I have seen were up to 54 sectors/track.
44
45         Although ESDI has been largely obsoleted by IDE and SCSI interfaces,
46         the availability of free or cheap surplus drives makes them 
47         ideal for low (or now) budget systems.
48
49     <sect2><heading>Concepts of ESDI</heading>
50       <p>
51       <sect3><heading>Physical connections</heading>
52         <p>
53         The ESDI interface uses two cables connected to each drive. 
54         One cable is a 34 pin flat cable edge connector that carries
55         the command and status signals from the controller to the
56         drive and vice-versa. The command cable is daisy chained
57         between all the drives. So, it forms a bus onto which all
58         drives are connected.
59
60         The second cable is a a 20 pin flat cable edge connector that
61         carries the data to and from the drive. This cable is radially
62         connected, so each drive has its own direct connection to the
63         controller.
64
65         To the best of my knowledge PC ESDI controllers are limited
66         to using a maximum of 2 drives per controller. This is
67         compatibility feature(?) left over from the WD1003 standard
68         that reserves only a single bit for device addressing.
69
70       <sect3><heading>Device addressing</heading>
71         <p>
72         On each command cable a maximum of 7 devices and 1 controller
73         can be present. To enable the controller to uniquely 
74         identify which drive it addresses, each ESDI device is equipped
75         with jumpers or switches to select the devices address.
76
77         On PC type controllers the first drive is set to address 0, 
78         the second disk to address 1. <it>Always make sure</it> you
79         set each disk to an unique address! So, on a PC with its
80         two drives/controller maximum the first drive is drive 0, the
81         second is drive 1.
82
83       <sect3><heading>Termination</heading>
84         <p>
85         The daisy chained command cable (the 34 pin cable remember?)
86         needs to be terminated at the last drive on the chain.
87         For this purpose ESDI drives come with a termination resistor
88         network that can be removed or disabled by a jumper when it
89         is not used.
90
91         So, one and <it>only</it> one drive, the one at 
92         the farthest end of the command
93         cable has its terminator installed/enabled. The controller
94         automatically terminates the other end of the cable. 
95         Please note that this implies that the controller must be 
96         at one end of the cable and <it>not</it> in the middle.
97
98     <sect2><heading>Using ESDI disks with FreeBSD</heading>
99       <p>
100         Why is ESDI such a pain to get working in the first place?
101       
102         People who tried ESDI disks with FreeBSD are known to have
103         developed a profound sense of frustration. A combination of
104         factors works against you to produce effects that are
105         hard to understand when you have never seen them before.
106
107         This has also led to the popular legend ESDI and FreeBSD
108         is a plain NO-GO.
109         The following sections try to list all the pitfalls and 
110         solutions.
111
112       <sect3><heading>ESDI speed variants</heading>
113         <p>
114         As briefly mentioned before, ESDI comes in two speed flavors.
115         The older drives and controllers use a 10 Mbits/second
116         data transfer rate. Newer stuff uses 15 Mbits/second.
117         
118         It is not hard to imagine that 15 Mbits/second drive cause
119         problems on controllers laid out for 10 Mbits/second.
120         As always, consult your controller <it>and</it> drive 
121         documentation to see if things match.
122
123       <sect3><heading>Stay on track</heading>
124         <p>
125         Mainstream ESDI drives use 34 to 36 sectors per track. 
126         Most (older) controllers cannot handle more than this 
127         number of sectors.
128         Newer, higher capacity, drives use higher numbers of sectors
129         per track. For instance, I own a 670 Mb drive that has
130         54 sectors per track.
131
132         In my case, the controller could not handle this number
133         of sectors. It proved to work well except that it only
134         used 35 sectors on each track. This meant losing a
135         lot of disk space.
136
137         Once again, check the documentation of your hardware for 
138         more info. Going out-of-spec like in the example might
139         or might not work. Give it a try or get another more
140         capable controller.
141
142       <sect3><heading>Hard or soft sectoring</heading>
143         <p>
144         Most ESDI drives allow hard or soft sectoring to be 
145         selected using a jumper. Hard sectoring means that the
146         drive will produce a sector pulse on the start of each
147         new sector. The controller uses this pulse to tell when
148         it should start to write or read.
149
150         Hard sectoring allows a selection of sector size (normally
151         256, 512 or 1024 bytes per formatted sector). FreeBSD uses 
152         512 byte sectors. The number of sectors per track also varies 
153         while still using the same number of bytes per formatted sector. 
154         The number of <em>unformatted</em> bytes per sector varies,
155         dependent on your controller it needs more or less overhead 
156         bytes to work correctly. Pushing more sectors on a track 
157         of course gives you more usable space, but might give 
158         problems if your controller needs more bytes than the 
159         drive offers.
160
161         In case of soft sectoring, the controller itself determines
162         where to start/stop reading or writing. For ESDI 
163         hard sectoring is the default (at least on everything
164         I came across). I never felt the urge to try soft sectoring.
165
166         In general, experiment with sector settings before you install
167         FreeBSD because you need to re-run the low-level format
168         after each change.
169
170       <sect3><heading>Low level formatting</heading>
171         <p>
172         ESDI drives need to be low level formatted before they
173         are usable. A reformat is needed whenever you figgle
174         with the number of sectors/track jumpers or the
175         physical orientation of the drive (horizontal, vertical). 
176         So, first think, then format. 
177         The format time must not be underestimated, for big
178         disks it can take hours. 
179
180         After a low level format, a surface scan is done to
181         find and flag bad sectors. Most disks have a
182         manufacturer bad block list listed on a piece of paper
183         or adhesive sticker. In addition, on most disks the
184         list is also written onto the disk.
185         Please use the manufacturer's list. It is much easier
186         to remap a defect now than after FreeBSD is installed.
187
188         Stay away from low-level formatters that mark all
189         sectors of a track as bad as soon as they find one
190         bad sector. Not only does this waste space, it also
191         and more importantly causes you grief with bad144
192         (see the section on bad144).
193         
194       <sect3><heading>Translations</heading>
195         <p>
196         Translations, although not exclusively a ESDI-only problem, 
197         might give you real trouble.
198         Translations come in multiple flavors. Most of them 
199         have in common that they attempt to work around the
200         limitations posed upon disk geometries by the original
201         IBM PC/AT design (thanks IBM!).
202
203         First of all there is the (in)famous 1024 cylinder limit.
204         For a system to be able to boot, the stuff (whatever 
205         operating system) must be in the first 1024 cylinders
206         of a disk. Only 10 bits are available to encode the
207         cylinder number. For the number of sectors the limit
208         is 64 (0-63).
209         When you combine the 1024 cylinder limit with the 16 head
210         limit (also a design feature) you max out at fairly limited 
211         disk sizes. 
212
213         To work around this problem, the manufacturers of ESDI
214         PC controllers added a BIOS prom extension on their boards.
215         This BIOS extension handles disk I/O for booting (and for
216         some operating systems <it>all</it> disk I/O) by using 
217         translation. For instance, a big drive might be presented
218         to the system as having 32 heads and 64 sectors/track. 
219         The result is that the number of cylinders is reduced to
220         something below 1024 and is therefore usable by the system
221         without problems.
222         It is noteworthy to know that FreeBSD does not use the
223         BIOS after its kernel has started.  More on this later.
224
225         A second reason for translations is the fact that most
226         older system BIOSes could only handle drives with 17 sectors
227         per track (the old ST412 standard). Newer system BIOSes 
228         usually have a user-defined drive type (in most cases this is
229         drive type 47).
230
231         <em>Whatever you do to translations after reading this document,
232         keep in mind that if you have multiple operating systems on the
233         same disk, all must use the same translation</em>
234
235         While on the subject of translations, I have seen one controller
236         type (but there are probably more like this) offer the option
237         to logically split a drive in multiple partitions as a BIOS
238         option. I had select 1 drive == 1 partition because this
239         controller wrote this info onto the disk. On power-up it
240         read the info and presented itself to the system based on
241         the info from the disk.
242
243       <sect3><heading>Spare sectoring</heading>
244         <p>
245         Most ESDI controllers offer the possibility to remap bad sectors.
246         During/after the low-level format of the disk bad sectors are
247         marked as such, and a replacement sector is put in place
248         (logically of course) of the bad one. 
249
250         In most cases the remapping is done by using N-1 sectors on
251         each track for actual data storage, and sector N itself is 
252         the spare sector. N is the total number of sectors physically
253         available on the track.
254         The idea behind this is that the operating system sees
255         a 'perfect' disk without bad sectors. In the case of
256         FreeBSD this concept is not usable.
257
258         The problem is that the translation from <it>bad</it> to <it>good</it>
259         is performed by the BIOS of the ESDI controller. FreeBSD,
260         being a true 32 bit operating system, does not use the BIOS
261         after it has been booted. Instead, it has device drivers that
262         talk directly to the hardware.
263
264         <em>So: don't use spare sectoring, bad block remapping or
265         whatever it may be called by the controller manufacturer when you
266         want to use the disk for FreeBSD.</em>
267         
268       <sect3><heading>Bad block handling</heading>
269         <p>
270         The preceding section leaves us with a problem. The controller's
271         bad block handling is not usable and still FreeBSD's filesystems
272         assume perfect media without any flaws.
273         To solve this problem, FreeBSD use the <it>bad144</it> tool.
274         Bad144 (named after a Digital Equipment standard for bad block
275         handling) scans a FreeBSD slice for bad blocks. Having found
276         these bad blocks, it writes a table with the offending block
277         numbers to the end of the FreeBSD slice. 
278
279         When the disk is in operation, the disk accesses are checked 
280         against the table read from the disk. Whenever a block number
281         is requested that is in the bad144 list, a replacement block
282         (also from the end of the FreeBSD slice) is used.
283         In this way, the bad144 replacement scheme presents 'perfect'
284         media to the FreeBSD filesystems.
285
286         There are a number of potential pitfalls associated with 
287         the use of bad144.
288         First of all, the slice cannot have more than 126 bad sectors.
289         If your drive has a high number of bad sectors, you might need
290         to divide it into multiple FreeBSD slices each containing less
291         than 126 bad sectors. Stay away from low-level format programs
292         that mark <em>every</em> sector of a track as bad when 
293         they find a flaw on the track. As you can imagine, the 
294         126 limit is quickly reached when the low-level format is done
295         this way.
296
297         Second, if the slice contains the root filesystem, the slice
298         should be within the 1024 cylinder BIOS limit. During the
299         boot process the bad144 list is read using the BIOS and this
300         only succeeds when the list is within the 1024 cylinder limit.
301         <em>Note</em> that the restriction is not that only the root
302         <em>filesystem</em> must be within the 1024 cylinder limit, but
303         rather the entire <em>slice</em> that contains the root filesystem.
304
305
306       <sect3><heading>Kernel configuration</heading>
307         <p>
308         ESDI disks are handled by the same <it>wd</it>driver as
309         IDE and ST412 MFM disks. The <it>wd</it> driver should work
310         for all WD1003 compatible interfaces. 
311         
312         Most hardware is jumperable for one of two different I/O
313         address ranges and IRQ lines. This allows you to have 
314         two wd type controllers in one system. 
315
316         When your hardware allows non-standard strappings, you
317         can use these with FreeBSD as long as you enter the 
318         correct info into the kernel config file.
319         An example from the kernel config file (they live in
320         <tt>/sys/i386/conf</tt> BTW).
321
322 <tscreen><verb>
323 # First WD compatible controller
324 controller      wdc0    at isa? port "IO_WD1" bio irq 14 vector wdintr
325 disk            wd0     at wdc0 drive 0
326 disk            wd1     at wdc0 drive 1
327
328 # Second WD compatible controller
329 controller      wdc1    at isa? port "IO_WD2" bio irq 15 vector wdintr
330 disk            wd2     at wdc1 drive 0
331 disk            wd3     at wdc1 drive 1
332 </verb></tscreen>
333
334 <!--
335       <sect3><heading>Tuning your ESDI kernel setup</heading>
336         <p>
337 -->
338
339     <sect2><heading>Particulars on ESDI hardware</heading>
340       <p>
341         <sect3><heading>Adaptec 2320 controllers</heading>
342         <p>
343         I successfully installed FreeBSD onto a ESDI disk controlled by a
344         ACB-2320. No other operating system was present on the disk.
345
346         To do so I low level formatted the disk using NEFMT.EXE 
347         (<it>ftp</it>able from <it>www.adaptec.com</it>) and answered NO
348         to the question whether the disk should be formatted with a
349         spare sector on each track. The BIOS on the ACD-2320 was
350         disabled. I used the 'free configurable' option in the system
351         BIOS to allow the BIOS to boot it.
352
353         Before using NEFMT.EXE I tried to format the disk using the
354         ACB-2320 BIOS builtin formatter. This proved to be a show stopper,
355         because it did not give me an option to disable spare sectoring.
356         With spare sectoring enabled the FreeBSD installation
357         process broke down on the bad144 run.
358
359         Please check carefully which ACB-232xy variant you have. The
360         x is either 0 or 2, indicating a controller without or with
361         a floppy controller on board. 
362
363         The y is more interesting.  It can either be a blank, 
364         a "A-8" or a "D".  A blank indicates a plain 10 Mbits/second
365         controller. An "A-8" indicates a 15 Mbits/second controller
366         capable of handling 52 sectors/track.
367         A "D" means a 15 Mbits/second controller that can also
368         handle drives with > 36 sectors/track (also 52 ?).
369
370         All variations should be capable of using 1:1 interleaving. Use 1:1,
371         FreeBSD is fast enough to handle it.
372
373         <sect3><heading>Western Digital WD1007 controllers</heading>
374         <p>
375         I successfully installed FreeBSD onto a ESDI disk controlled by a
376         WD1007 controller. To be precise, it was a WD1007-WA2. Other
377         variations of the WD1007 do exist.
378
379         To get it to work, I had to disable the sector translation and
380         the WD1007's onboard BIOS. This implied I could not use 
381         the low-level formatter built into this BIOS. Instead, I grabbed
382         WDFMT.EXE from www.wdc.com Running this formatted my drive
383         just fine. 
384         
385         <sect3><heading>Ultrastor U14F controllers</heading>
386         <p>
387         According to multiple reports from the net, Ultrastor ESDI 
388         boards work OK with FreeBSD. I lack any further info on
389         particular settings.
390         
391 <!--
392
393     <sect2><heading>Tracking down problems</heading>
394       <p>
395 -->
396
397     <sect2><heading>Further reading<label id="esdi:further-reading"></>
398       <p>
399         If you intend to do some serious ESDI hacking, you might want to
400         have the official standard at hand:
401
402         The latest ANSI X3T10 committee document is:
403         <itemize>
404 <item>Enhanced Small Device Interface (ESDI) &lsqb;X3.170-1990/X3.170a-1991&rsqb;   
405                                    &lsqb;X3T10/792D Rev 11&rsqb;
406         </itemize>
407         On Usenet the newsgroup <htmlurl url="news:comp.periphs"
408         name="comp.periphs"> is a noteworthy place to look 
409         for more info.
410
411         The World Wide Web (WWW) also proves to be a very handy info source:
412         For info on Adaptec ESDI controllers see <htmlurl
413         url="http://www.adaptec.com/">.
414         For info on Western Digital controllers see <htmlurl
415         url="http://www.wdc.com/">.
416
417     <sect2>Thanks to...
418         <p>
419         Andrew Gordon for sending me an Adaptec 2320 controller and ESDI disk 
420         for testing.
421