Re: mounted partition sizes/offsets

Harald Koenig (koenig@tat.physik.uni-tuebingen.de)
Wed, 13 Aug 1997 10:42:30 +0200


On Aug 12, Marty Leisner wrote:

> I accidently erased clobbered my first partition on my disk on
> a running system
> (I put an array by an accident when I ran fdisk
> (i.e. cfdisk -P t >/dev/hda
> instead of
> cfdisk -P t /dev/hda
>
> I didn't loose much, while the system was running on copied all stuff I did
> to other machines.

sounds like the machine already has been powered down by now ?!

> But this brings me back to the question: how do I reconstruct
> what's going on? Is there a way to figure out the device/sectors
> of the partitions? It seems useful. (i.e. a /proc entry called partitions).

if you've installed LILO in the MBR (and partitioning hasn't changed since then)
you can use /boot/boot.0300, it's the backup copy of the MBR and contains the
partition table. just do

cp /boot/boot.0300 /dev/hda

and you're back in business...

once you shut down the system it's a bit harder. write a small program
which scanns every sector of /dev/hda and looks for sectors starting
with 0xeb 0x65 and ending with 0x55 0xaa (this is how all my boot blocks look like).
either boot the system from floppy (rescure) disk or mount the hard disk
on an other system. check those sectors if they look like real boot blocks --
at least one of them should be /boot/boot.0300 ...

having the output of "fdisk -l" on paper, floppy disk, or whereever (backup, you know;)
is enough too to rebuild the partition table.

Harald

--
All SCSI disks will from now on                     ___       _____
be required to send an email notice                0--,|    /OOOOOOO\
24 hours prior to complete hardware failure!      <_/  /  /OOOOOOOOOOO\
                                                    \  \/OOOOOOOOOOOOOOO\
                                                      \ OOOOOOOOOOOOOOOOO|//
Harald Koenig,                                         \/\/\/\/\/\/\/\/\/
Inst.f.Theoret.Astrophysik                              //  /     \\  \
koenig@tat.physik.uni-tuebingen.de                     ^^^^^       ^^^^^