Xref: utzoo comp.sys.amiga:58758 comp.sys.amiga.tech:12335 Path: utzoo!attcan!uunet!cs.utexas.edu!asuvax!mcdphx!fishpond!fnf From: fnf@fishpond.UUCP (Fred Fish) Newsgroups: comp.sys.amiga,comp.sys.amiga.tech Subject: Re: hd users question Message-ID: <111@fishpond.UUCP> Date: 31 May 90 04:05:12 GMT References: <11926@cbmvax.commodore.com> Reply-To: fnf@fishpond.UUCP (Fred Fish) Organization: Amiga Library Services Lines: 56 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