rebuilding trashed partition map?

rebuilding trashed partition map?

Post by Jay Kre » Sun, 18 Feb 1996 04:00:00

I need help.
Last night, I believe I dd'ed to /dev/hda instead of /dev/hda1,
overwriting (part of?) my partition map, instead of overwriting
LILO with the NT boot loader.

Now, I figure if I could remember exactly my partitioning, I could
just recreate it (is the partition map totally at the start of the
disk, or do extended partitions have their own maps "later" in the disk?)

I know my setup was roughly
/dev/hda1 primary, 100 meg, DOS (recovered by repartitioning, and
installed Windows 95 so I could network)
/dev/hda2 extended 1.1 gig
/dev/hda5 logical ~500 meg, NT
/dev/hda6 logical ~500 meg, Linux
perhaps some swap volume (not necessary)

The key, I think, is to remeber those ~500 meg.

I have a few ideas for recovery approaches, but they are based in
ignorance. I'm hoping someone here might have file system/partition map
expertise and/or software to help me.

My main idea is I could probably start with the NT partition small,
cutting off its tail, and increase it till I get errors, but, actually,
I'm not sure it'd notice if it consumed the start of Linux, nor am I
sure it won't write to it, so that leads me to, well, the same thing,
but booting Linux instead of NT - keep changing the start of the Linux
partition till it boots. I'm hoping to od | grep /dev/hda or /dev/hda6
to help me locate the start. Like "LILO" should be near the start.
In fact, I have a copy of the first 512 bytes of /dev/hda6 in
c:\bootsect.lin, so I can scan for that. Is that at the exact start
of the partition, or would there be stuff before it?

Might something like this work:
I can't compile C from Linux boot floppies, so get GNU-WIN32.
Get rawwrite to learn how to "raw read".
Read in file bootsect.lin.
Keep reading 512 byte blocks from "/dev/hda" (hopefully can get to it
from Windows 95/DOS) and comparing to bootsect.lin (memcmp).
When it matches, print the offset, convert to MB, and that's the
start of my Linux partition???

Any help is greatly appreciated; thanks,



rebuilding trashed partition map?

Post by Andries Brouw » Sun, 18 Feb 1996 04:00:00

: When it matches, print the offset, convert to MB, and that's the
: start of my Linux partition???

Do not convert to MB, but keep the info in sectors accurate.
Use fdisk 3.04, and let it write the old sector(s) to floppy
or to another disk. Search for the aa55 word that characterizes
boot blocks.


1. Reviving a disk whose partition map was trashed

Is there a utility other than the format command that can be used to revive a
disk whose 0 sector was written to as a raw disk? The format command keeps
dumping core when I try to use it to revive this disk. It can't find any
labels on the disk at all. Am I out of luck?

Eston Burciaga
Context Integration

2. SSH MAC Error

3. Putting Solaris on a partition without trashing my Windows partition.

4. adding harddrive

5. ypserv - rebuilding maps faster, overriding shell on a machine

6. root disks, boot disks

7. PLEASE HELP: LILO trashed keeps trashing my mbr

8. Tricky LDAP question

9. trashed h/d partition table

10. Trashing NT partition for Linux, Part II

11. rebuilt FreeBSD => rebuild all ports + reload all packages?

12. Need help: fdisk / 1+G scsi HD / dos trashes adjacent partition

13. HELP: Linux partition trashed by DOS virus!