Subject: Re: Partition table on x86 trashed. Any ideas?
To: Gerald Heinig <Gerald.Heinig@post.rwth-aachen.de>
From: Frederick Bruckman <email@example.com>
Date: 09/08/2001 08:37:11
On Sat, 8 Sep 2001, Gerald Heinig wrote:
> My question is: how do I resurrect my partition table? If the worst
> really comes to the worst, I can use dd to fish out various disk blocks
> which I know have stuff in them that I need. I haven't actually lost
> very much: only about 5 or 10 files which aren't very big, but there's a
> lot of know-how that's in them and it would really hurt to lose them.
A block that contains either a master boot record or partition table
will have "0x55aa" at the very end of it. If you have some idea where
the NetBSD partition is, you can use that information to find where it
starts exactly. Say you know that it's about 6G into the disk. So fish
around with something like
dd if=/dev/rwd0d skip=6000 count=400 bs=1mb |\
hexdump -C | grep '......f0.*55 aa'
then when you find it, calculate the block number of the NetBSD
partition, and use "fdisk -i" to recreate a NetBSD partition using
that block as the start. (The end block isn't even critical, as the
NetBSD kernel only looks at the disklabel.)
Another way, if you ever saved your disklabels as text files, is to
search for the string in the disklabel. So insted of "hexdump", pipe
strings | grep -A 32 "^# /dev/rwd0d:"
Again, that should give you enough information to make a bootable
NetBSD partition, and others, too, if they were in the disklabel.