[comp.sys.amiga] hd users question

dale@cbmvax.commodore.com (Dale Luck - Amiga) (05/30/90)

This last week at Xhibition '90 while hooking an existing
working and partitioned disk drive up to an Amiga I accidentally
(second time in last 6 months) wiped out the partition information
on the disk drive by updating the rigid disk block info with the
default partition info. I spent about 3 days, off an on trying
to recover the partition information by changing my partition
sizes which I roughly still new but it has 1400 cylinders and there
were three partition so it took awhile.

I finally got a copy of disksalv and set it to work on an estimate
for a parition. Told it to scan for blocks around what I thought was
the proper partition and eventually noticed the bright red "root block"
directory go by. Since the little window was up that was telling me which
block it was reading I could zero in on the root block with a better
accurate guess. Update the partition info since on the fast file system
the root block is right in the middle of the partition.

My question:
   Has anyone else ever accidentally blown there parition info away and
were lost as to how to recover it? The data on the disk is all there
it just does not know where the start and end of the partition is.
By the way, the first time I did it either I found a piece of paper with
the cyl info written on it or I decided to just start over and hope
that I did not loose any non backed up info.

Please send email since I am kind of taking a poll.
Dale Luck

fnf@fishpond.UUCP (Fred Fish) (05/31/90)

In article <11926@cbmvax.commodore.com> dale@cbmvax.UUCP (Dale Luck - Amiga) writes:
>			I spent about 3 days, off an on trying
>to recover the partition information by changing my partition
>sizes which I roughly still new but it has 1400 cylinders and there
>were three partition so it took awhile.
>
>Update the partition info since on the fast file system
>the root block is right in the middle of the partition.
>
>   Has anyone else ever accidentally blown there parition info away and
>were lost as to how to recover it? The data on the disk is all there
>it just does not know where the start and end of the partition is.

Well, given the following assumptions about the disk layout (which
I believe to be close to reality :-):

	(1)	The root block for each partition is exactly in the
		middle of the partition and can be identified by
		it independent examination of each block.

	(2)	There is a small reserved area at the beginning of the
		disk for the RDB stuff.  This is of known or determinable
		size.

Thus a disk with three partitions would be laid out as:

	RDB  A0 A A1  B0 B B1  C0 C C1

where

	RDB is a known size
	A, B, and C are the root blocks and are at known offsets
	A0,A1 B0,B1 C0,C1 are of unknown size

Assuming A0=A1 B0=B1 and C0=C1, and that A, B, and C are one block
long (for simplicity, a larger size just divides equally between
each half of the partition), and letting off(A) mean the block address
of A, we get the following equations:

	 A0 +   0 +  0 = off(A) - RDB - 0
	2A0 +  B0 +  0 = off(B) - RDB - 1
	2A0 + 2B0 + C0 = off(C) - RDB - 2

These are three equations in three unknowns (everything on the rhs is
a constant or is known by scanning the disk), so just solve for A0, B0,
and C0, and then you can trivially compute the sizes and offsets of
each partition.

Someone should write a program to scan the disk counting root blocks
(to get the number of partitions), set up and solve the linear equations,
and spit out the partition information.

-Fred
-- 
# Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284,  USA
# 1-602-491-0048               asuvax!mcdphx!fishpond!fnf

panon@cheddar.ucs.ubc.ca (Paul-Andre Panon) (06/01/90)

In article <111@fishpond.UUCP> fnf@fishpond.UUCP (Fred Fish) writes:
>In article <11926@cbmvax.commodore.com> dale@cbmvax.UUCP (Dale Luck - Amiga) writes:
>>
>>   Has anyone else ever accidentally blown there parition info away and
>>were lost as to how to recover it? The data on the disk is all there
>>it just does not know where the start and end of the partition is.
>
>[Fread writes about recovery techniques]
>Someone should write a program to scan the disk counting root blocks
>(to get the number of partitions), set up and solve the linear equations,
>and spit out the partition information.
>
>-Fred
>-- 
># Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284,  USA
># 1-602-491-0048               asuvax!mcdphx!fishpond!fnf
I once had to recover a hard drive where the boot partition (and of course
the hard drive mountlist) got trashed. Once. Fortunately, I had just
installed it three days earlier so after a few hours worth of trying,
I finally stumbled across the right combination and re-installed the boot
partition & mountlist.

Solution: keep a copy of your HD mountlist (expanded to include the boot
partition) on a write-protected floppy somewhere safe. The time you'll save
is well worth the $2.00 for the floppy. This way you can mount the working
partitions and back them up if the problem is so bad that you have to low-level
format the drive, and can reinstall AmigaDOS trivially otherwise. I think this
procedure should be recommended in the manuals for all Amigas which come with
hard drives (A2000HD, A2500, A3000). What I want is a program which will
rebuild RES0: given that expanded mountlist. It is probably trivial to do.
I may even do it someday if I can find out what RES0: is supposed
to contain and its correct format.

Fred's program suggestion is very nice but people shouldn't start depending
on it and they probably would if the program was available.
An ounce of prevention is worth a pound of cure.
--
    Paul-Andre_Panon@staff.ucs.ubc.ca        or    USERPAP1@UBCMTSG 
or  Paul-Andre_Panon@undergrad.cs.ubc.ca     or    USERPAP1@mtsg.ubc.ca
Looking for a .signature? "We've already got one. It is ver-ry ni-sce!"