Re: partition table woes
On Fri, Jul 27, 2001 at 12:46:50AM -0700, Karsten M. Self wrote:
| on Fri, Jul 27, 2001 at 12:26:35AM -0400, dman (dsh8290@rit.edu) wrote:
| >
| > I screwed up my partition table today and, like an idiot, I don't have
| > a record of it. Are there any tools I can use to determine where my
| > partitions were?
|
| No specific tools I'm aware of. I keep a hardcopy printout of my
| partition tables and mount schemes, backed up by my paritioning HOWTO
| (doing double-duty as another backup of my partition tables).
I will definitely have a hardcopy backup after I get it fixed!
| > I have a 10GB IDE disk, hda. I had hda1 as /, hda2 as swap and hda3
| > as /home. The space was approximately evenly divided between / and
| > /home and 256MB swap. Obviously / starts at sector 1. I determined,
| > through trial-and-error, that / ends not before sector 748, but fsck
| > doesn't complain if I make the partition too big. I don't think I
| > have the size quite right because when I add 256MB to that and
| > allocate /home I get errors about an invalid superblock. I can run
| > debugfs on / and see all the data in that superblock. There must be
| > some way (even looking at the raw bits on the disk) to determine where
| > the partitions started prior to my screw up. It is (was) a woody
| > system and I have potato CDs (ie rescue disk).
|
| I think the following may work. I've managed to recover a partition
| table from memory before.
|
| If you know how you sized your partitions, you can try plugging in the
| appropriate values, and saving the table. Since the partition table
| doesn't actually modify disk data, this won't scramble your data. I'd
| restrict my mounts to read-only -- if you size things right, your
| filesystems should match up, if you don't, they should break. That's
| the theory.
|
| It's a bit seat-of-your-pants, and it's a last-ditch suggestion, and
| it's crazy, but it might just work....
It worked, more-or-less for the first partition. I knew where it
started so it was just a matter of finding the end. The problem is,
neither mount nor fsck seem to care if the partition is too big, only
if it is too small. I found the minimum size it must be for no
complaints (1 sector smaller tells me that the super block says the
partition is bigger than it really is). I am not sure that it is the
right size because when I add in the swap size (I remember that was
256MB, though I'm not as certain anymore) to determine where the third
partition starts, it doesn't work.
I was hoping that there was some tool to (at the very least) give me a
raw dump of a certain section of the disk that with a bit of RTFM on
ext2 I could determine where the superblock (start of partition) is.
(If you have a partition with a valid super block, run 'debugfs' on it
and type "stats" at the debugfs prompt. It's very interesting)
Oh, well, thanks for the response anyways.
-D
Reply to: