Corrupted Partition Table (solution)

Carlo Wood (carlo@runaway.xs4all.nl)
Fri, 26 Sep 1997 16:53:54 +0200 (MET DST)


Solution to corrupted logical partition table
---------------------------------------------

Hi all,

a few months ago I mailed about the problem that I had a corrupted
partition table every now and then. John Fort mailed me how to fix
this problem. I took a month extra to test his solution and
it seems that it indeed solves the problem !

Problem description:
--------------------

Every few months - sometimes more often - the logical partition
table gets corrupted. This can be the first logical partition
(and all other logical partitions) or the second logical partition
(and all partitions above) and sometimes the third or higher
logical partition (and all logical partitions above).

The corruption exists of a corrupted link in the chain of partitions
or a moved partition without correctly updated link.

It happened to me most when I editted a large file, preferably one
that made my partition run out of space (but not necessarily).

Note that the corruption of the logical partitions has no effect
on the working of the system, until you reboot. And in general
is only visible by running fdisk (which I have done now every
5 minutes, automatically, for over a year - to be able to immedeately
detect the problem).

Solution
--------

If your partition table is corrupted then the solution is to
run fdisk and re-enter (by hand) all starts and ends of the
corrupted partitions, and write the partition table to disk
again. This totally restores everything to normal.

A permanent solution can be adchieved by letting the FIRST
logical partition start at the same cylinder number as the
extended partition starts on (Thanks to John Fort for finding
out about this).

Here is an example of my partition table:

Disk /dev/hda: 128 heads, 63 sectors, 779 cylinders
Units = cylinders of 8064 * 512 bytes

Device Boot Begin Start End Blocks Id System
/dev/hda1 1 1 261 1052320+ 6 DOS 16-bit >=32M
/dev/hda2 262 262 294 133056 82 Linux swap
/dev/hda3 * 295 295 306 48384 83 Linux native
/dev/hda4 307 307 779 1907136 5 Extended
/dev/hda5 307 307 356 201568+ 83 Linux native
/dev/hda6 358 358 382 100800 83 Linux native
/dev/hda7 383 383 407 100800 83 Linux native
/dev/hda8 408 408 432 100800 83 Linux native
/dev/hda9 433 433 444 48384 83 Linux native
/dev/hda10 445 445 456 48384 83 Linux native
/dev/hda11 457 457 481 100800 83 Linux native
/dev/hda12 482 482 506 100800 83 Linux native
/dev/hda13 507 507 556 201600 83 Linux native
/dev/hda14 557 557 779 899136 83 Linux native

As you can see, /dev/hda5 start on cyl 307, which is the same as
where /dev/hda4 starts. This alone was enough to fix the problem.
(The hole between /dev/hda5 and /dev/hda6 is because I only moved
/dev/hda5 down; before /dev/hda5 started at 308).

Carlo Wood

Forwarded message:
| From johnf@werple.net.au Sat Aug 16 03:19:06 1997
| Date: Sat, 16 Aug 1997 09:09:50 +1000 (EST)
| From: John Fort <johnf@werple.net.au>
| To: carlo@runaway.xs4all.nl
| Subject: Corrupted Partition Table
| Message-ID: <Pine.SOL.3.91.970816090904.13056A-100000@werple.net.au>
| MIME-Version: 1.0
| Content-Type: TEXT/PLAIN; charset=US-ASCII
|
| Carlo,
|
| The answer is to start the first partition within an extended partition
| on the same cylinder number as the extended partition starts on.
...
| I don't know why this happens with extended partitions, I too, found
| out the hard way. Would love to see the real answer.
|
| cu johnf@whitsunday.net.au

-- 
 carlo@runaway.xs4all.nl, Run @ IRC.

ircd development: http://www.xs4all.nl/~carlo17/ircd-dev