Subject: Re: Now I've really done it: I have no more mbr
To: None <current-users@NetBSD.org>
From: Alan Barrett <email@example.com>
Date: 08/19/2003 10:15:10
On Mon, 18 Aug 2003, Hisashi T Fujinaka wrote:
> OK, so is there some way of mounting the entire disk and searching for
> /var/backup to regenerate my mbr or am I totally hosed this time?
Since you say "mbr", I'll assume that it's an i386 system.
Were there multiple MBR partitions (say for more than one OS)? If not,
then you just have to find the start of the first MBR partition (which
would be for NetBSD).
The first MBR partition usually starts at offset 63. Other plausible
values to check are 0 (if you use what FreeBSD calls "dangerously
dedicated" mode, where what would normally have been the PBR for the OS
is in sector 0 where the MBR is supposed to live); 1 (if you don't want
to waste any space); whatever the track size is (if it's not 63); and
whatever the cylinder size is. Once you find the start of the first
MBR partition, with any luck you'll know what type it was, and it will
contain some kind of label in some known format telling you its own
size. That helps you find the start of the next MBR partition, so you
can continue the process if necessary.
*BSD disklabels have magic numbers that should be easy to find. I am
sure I've seen references to a program that searches a disk for labels,
but I can't remember where.
--apb (Alan Barrett)