[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help straightening out disk partitions.

> Here is the testdisk output which cites the error, described differently by
> each program but this is it:
> Disk /dev/hdb - CHS 65536 16 63 - 32256 MB

> Thanks--Any help greatly appreciated!

I'd do

 sfdisk -d /dev/hdb

Then look at the resulting output to make sure it all adds up correctly.  This 
is an example of a *good* partition table.  Everything fits, and there are 
63-sector gaps between partitions.  Let's break it down:

->sfdisk -d /dev/hda
# partition table of /dev/hda
unit: sectors

/dev/hda1 : start=       63, size=   195489, Id=83, bootable

Next one should start at (195489 + 63) 195552

/dev/hda2 : start=   195552, size= 77969808, Id= 5

Check.  Now, a2 is an extended partition (type 5), so it should run from here 
to the end of the disk.  If the logical partitions contained within this one 
go past 77969808, there's trouble.

/dev/hda3 : start=        0, size=        0, Id= 0
/dev/hda4 : start=        0, size=        0, Id= 0

(No third or fourth primary.  That's fine.)

/dev/hda5 : start=   195615, size=  1999809, Id=83

Starts at 195615.  Is that 195552 + 63?  Yes, so that's fine.

Should be 195615 + 1999809 + 63 to start the next one.

/dev/hda6 : start=  2195487, size=  8000433, Id=83

Starts at 2195487.  That does add up.  Check.

Should be 2195487 + 8000433 + 63 to start the next one.

/dev/hda7 : start= 10195983, size= 19999665, Id=83

Starts at 10195983.  That does add up.  Check.

Should be 10195983 + 19999665 + 63 to start the next one.

/dev/hda8 : start= 30195711, size= 47969649, Id=83

Starts at 30195711.  That does add up.   Check.

So then do all of these add up to the available space, or less?

Total all the size= and come up with 77969556.  Add in the 63 sector 
separations between the four partitions, and hit 77969808 spot on the money.

So this partition table checks out perfectly.

If yours doesn't, first you have to figure out what's wrong with it.  
Partitions overlapping, partitions not properly separated, more space 
allocated than the extended partition can hold, partitions not starting ont 
he right boundaries, etc.

Once you know what's wrong with it, it's probably possible to fix it.  I have 
to admit I'm much more rusty on the doing something about it side of things 
than the discovering trouble side.  I rebuilt a partition table from scratch 
once, straightening out a mess a bad partition resize had left, but I don't 
quite remember exactly how I did it.  I do remember starting with a list like 
this, figuring out what it was supposed to say, and then putting it there.  
It involved destroying the original partition table and writing a new one 
from scratch.  I pulled it off by the hair on my chinny chin chin, but I 
don't remember enough about the process to write you a recipe book.

Michael McIntyre  ----   Silvan <dmmcintyr@users.sourceforge.net>
Linux fanatic, and certified Geek;  registered Linux user #243621

Reply to: