lkml.org 
[lkml]   [1997]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Really big mistake -- I need some help
On Jul 14, Kirk Bauer wrote:

> Okay, I managed to write over the first 300-500K of /dev/hda.

tsk tsk. Ob-answer: use your last night's backup (I know ;-))

> I still have not rebooted. I am trying to find a way to

good!! if you had install LILO in the MBR, you should have

/boot/boot.0300

which is a copy of your MBR when LILO was installed first.
if you haven't changed the partition layout since then, you
can just do

cp /boot/boot.0300 /dev/hda
lilo

but I'd check it first using

fdisk /boot/boot.0300
p

and so on...

> recreate the partition tables that are on the hard disk so
> that everything will be okay again. I can still do a
> 'df' and it will tell me how much space was on /dev/hda{1,3,5,6,7,9}.
> If I take the "Total" column from 'df' and multiply it by
> 1.0329, that will tell me how many blocks should be displayed
> in the 'fdisk' program.

df output doesn't show inode clocks etc. either use

hdparm -s /dev/hda1

or

wc -c < /dev/hda1


note that according to a quick test for hdparm output you have
to add one sector (512 bytes) for the extended partitions /dev/hda{5,6,7,9}

> My problem is -- notice that partitions 2 and 8 are not listed
> above. The reason is --these are both swap partitions. How
> can I find out how big each partition table is?
>
> Better yet -- I have a feeling that the kernel itself has
> enough information in internal memory to rebuild the partition
> table -- because *every* partition (except, of course, 4) is
> mounted right now (the mount was done back when I *did* have
> a partition table).
>
> So -- how can I find out how big each of my 2 swaps are

swapoff /dev/hda2
swapon /dev/hda2

gives a good estimate!

even better: read the first sector of each partition and write a small
C programm which scans the whole disk (/dev/hda) looking for this
sector. that way you can find (or at least check!) the real sector offset
for every partition...


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 ^^^^^ ^^^^^

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.060 / U:0.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site