Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jul 1996 19:26:13 -0500 (CDT)
From:      Dougal Campbell <dougal@iquest.com>
To:        Terry Lambert <terry@lambert.org>
Cc:        questions@freebsd.org
Subject:   Re: Partition table gone. Fixable?
Message-ID:  <Pine.BSI.3.93.960708185409.3972H-100000@vespucci.iquest.com>
In-Reply-To: <199607082341.QAA23007@phaeton.artisoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 8 Jul 1996, Terry Lambert wrote:

> > I've got a drive whose partition table was damaged somehow. Is there any
> > way to restore the partition table, and recover the filesystem data? Can
> > this be done with disklabel? The man pages aren't clear as to whether the
> > partition table is part of the "label", but it sort of implies such.
> > 
> > Is the data salvagable, or am I just boned?
> 
> It is salvagable.  This is a non-trivial task.  It has been discussed
> on this list before, and your best bet would be to go through the
> list archives.

Just do you know I didn't post here blindly, I *did* do a quick search
through the mailing list archives for the keywords "partition table". I
found a couple of people asking similar questions, and one semi-answer
talking about what magic number to look for (as a matter of fact, on
second glance, that message was from you, Terry :).  I emailed a copy of
that message to myself for reference. As I write this, I'm
doing some more searching....

> Do you know if it was the actualy partition table (the front of the
> physical disk)?  Or was it just the disklabel (there are options to
> disklabel, used during install, that will let you write a label
> wothout reading it first).

Well, if I try to mount, this is the error in /var/log/messages:

Jul  8 18:52:02 fubar /kernel: wd1: hard error reading fsbn 0wd1: status 79<rdy,wrtflt,seekdone,drq,err> error 4<abort>
Jul  8 18:52:02 fubar /kernel: wd1: error reading primary partition  table reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0)

I also get this error if I try "disklabel -r /dev/wd1".

If I remember correctly, this drive was partitioned in the "incompatible"
one-big-slice mode. I'm hoping that this means that recovery will be a
little simpler.

> You will probably need to reset the BSD bootstrap on the disk (-B).
> 
> To find the actual FS start offsets, you will need to read through the
> disk a sector at a time looking for the FS "magic numbers"; see the
> list archives referenced before for details.
> 
> 
> 					Terry Lambert
> 					terry@lambert.org

I had seen the -B option for disklabel, but was afraid to touch anything
until I had heard from someone more knowledgable on the subject. Also, I
didn't think it would really matter, since this was not the boot disk. As
you might guess from above, the machine has wd0 and wd1, and wd1 is the
afflicted disk, and it was mounted as /usr/local. Also, this is FreeBSD
2.1R. Will disklabel -B actually do anything useful in this case?

While I'm searching more of the mailing list archives, what other tips can
you offer? I've never had to deal with low-level disk repair before.
Nothing that couldn't be fixed by fsck, anyhow.  At least, not under
unix (I've hacked similar filesystems, like OS/9). What tools can I use
to read/modify sectors directly, if necessary -- dd? If I try disklabel -B
(or -w, for that matter), will I just screw things up even more?

--
Dougal Campbell     | "No animals or aliens were harmed in the making
Systems Coordinator |  of this film."
interQuest: Hsv, AL |  
dougal@iquest.com   |        --  Disclaimer in the credits for ID4




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.3.93.960708185409.3972H-100000>