From owner-freebsd-questions Mon Jul 8 17:27:33 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA03976 for questions-outgoing; Mon, 8 Jul 1996 17:27:33 -0700 (PDT) Received: from vespucci.iquest.com (vespucci.iquest.com [199.170.120.42]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id RAA03955 for ; Mon, 8 Jul 1996 17:27:30 -0700 (PDT) Received: from localhost (dougal@localhost) by vespucci.iquest.com (8.6.12/8.6.9 Secure) with SMTP id TAA04824; Mon, 8 Jul 1996 19:26:13 -0500 Date: Mon, 8 Jul 1996 19:26:13 -0500 (CDT) From: Dougal Campbell To: Terry Lambert cc: questions@freebsd.org Subject: Re: Partition table gone. Fixable? In-Reply-To: <199607082341.QAA23007@phaeton.artisoft.com> Message-ID: X-people-who-like-custom-headers: dougal@iquest.com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 error 4 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