Article View: comp.sys.atari.st
Article #27028A hard disk tale
From: schoepf
Date: Wed, 27 May 1987 14:49
Date: Wed, 27 May 1987 14:49
132 lines
5723 bytes
5723 bytes
I'm the proud owner of a hard disk. I installed three partitions with
10, 6 and 4 MB and worked with them until last week when suddenly the
disk broke down. What happened?
After three days (and some nights) of work I discovered that the HDX
program wrote bad partition information onto the disk boot sector.
Investigation of other hard disks showed that this seems to happen if
you do not choose one of the partition defaults.
To be more specific: I started from default 4-6-10 and changed it to
10-6-4. The HDX program correctly computed the new partition sizes,
but did not change the partition start sectors. This means that
partition #2 started after 4 Megabytes occupying the same space as the
last 6 MB of partition #1. Needless to say what happened after I
reached the 4 MB limit on #1.
The first sector of every partition is that partition's boot sector
containing the information how it is structured: length of FAT, length
of directory, start of FAT/directory etc.
Overwriting this will confuse BIOS and hard disk driver. The bios
parameter block you get from BIOS will contain real garbage. Trying to
access this partition from TOS probably bombs the system.
Even worse: if you start your desktop with a window for this damaged
partition GEM will not even finish booting.
There is *NO* protection at all against errors while your DESKTOP.INF
file is being read and processed by GEM.
OK, so you boot again with a Floppy containing a new DESKTOP.INF..
BUT if you boot from the hard disk you have no chance to delete the
DESKTOP.INF, because to delete it you need the hard disk switched on
and connected before booting, but booting does not work...
You got no chance -- formatting is also impossible.
(How I got out of this CATCH-22 situation? See below!)
THIS IS A VERY BAD BUG. After some weeks or months of decent work it
jumops at you from behind and you don't know why and how to get away
from it. There is no documentation how to access the hard disk boot
sector. (We found it out by disassembling the hard disk driver -- took
half a day of two people's time).
MORAL: Hard disk owners, BEWARE!
DO NOT CHOOSE YOUR OWN PARTITION SIZES UNTIL THIS IS FIXED!
But what if it really happens?
There is a way around. You need a floppy with an executable boot
sector that starts GEM. Then you start the hard disk driver, delete
DESKTOP.INF and/or deinstall the hard disk boot program, etc. If
everything fails you'll have to reformat the hard disk.
But how do you generate this special boot sector?
Well, there is a XBIOS function...
I include the little assembler program that I used:
********************************CUT HERE***********************
text
*
* First: generate boot sector contents in memory
*
move.w #1,-(a7) * make boot sector executable
move.w #3,-(a7) * 2 = single sided, 3 = double sided
move.l #$2000000,-(a7) * generate random serial number
pea BOOT(pc) * buffer for boot sector
move.w #18,-(a7) * 18 = PROTOBT
trap #14 * XBIOS
add.l #14,a7
*
* Then: write boot sector to disk, side 0, track 0, sector 1
*
move.w #1,-(a7) * count
move.w #0,-(a7) * side
move.w #0,-(a7) * track
move.w #1,-(a7) * sector
move.w #0,-(a7) * device
clr.l -(a7) * filler
pea BOOT(pc) * buffer
move.w #9,-(a7) * 9 = FLOPWR
trap #14 * XBIOS
add.l #20,a7
*
* Last: stop running
*
clr.w -(a7)
trap #1
*
* BUFFER for boot sector, must be 512 bytes long
*
BOOT
bra start(pc) * bra to start of boot code
dc.b 0,0,0,0,0,0 * unused
ds.b 22 * reserved for disk parameter block
start
move.l (a7)+,a5 * prepare for double return
move.l (a7)+,a5 * dito
pea null(pc) * empty environment string
pea null(pc) * no arguments
pea null(pc) * no filename
move.w #5,-(a7) * create basepage
move.w #$4b,-(a7) * Pexec
trap #1 * TOS
add.l #14,a7
move.l d0,a0 * save address of base page
move.l $4fe,8(a0) * fill in GEM's start address
pea null(pc) * no environment
move.l a0,-(a7) * base page address
pea null(pc) * no filename
move.w #4,-(a7) * start program
move.w #$4b,-(a7) * Pexec
trap #1 * TOS
add.l #14,a7
jmp (a5)
null dc.l 0
*
* reserve enough space (actually too much, but it doesn't matter)
*
ds.b 512
end
***************************CUT HERE**************************
In the hope that nobody else will spend his/her days and nights on
this any more,
Rainer Schoepf
<SCHOEPF@DMZRZU71.BITNET>
Technical Details
Message-ID:
<8705271449.AA18225@ucbvax.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!sri-spam!ames!sdcsvax!ucbvax!DMZRZU71.BITNET!schoepfShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!sri-spam!ames!sdcsvax!ucbvax!DMZRZU71.BITNET!schoepf From: schoepf@DMZRZU71.BITNET Newsgroups: comp.sys.atari.st Subject: A hard disk tale Message-ID: <8705271449.AA18225@ucbvax.Berkeley.EDU> Date: Wed, 27-May-87 10:49:47 EDT Article-I.D.: ucbvax.8705271449.AA18225 Posted: Wed May 27 10:49:47 1987 Date-Received: Fri, 29-May-87 06:26:56 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 132