Subject: Re: Bug? Help w/ wd*/wt*
To: Brian C. Grayson <>
From: Curt Sampson <>
List: port-i386
Date: 09/20/1996 09:25:29
On Fri, 20 Sep 1996, Jim Rees wrote:

> If you really overwrote the first 30 MB of your file system, I think it's
> hopeless.  That's where all the important stuff is.

No, it's not hopeless. There are three things you need for access
to files on a filesystem: the superblock, the inode, and the data

The superblock at the beginning of the disk was obviously wiped
out, but there are many copies of it all over the disk; if you
didn't use any odd parameters on newfs, fsck should be able to find
a good copy.

The disk itself is divided into `cylinder groups' of, oh, probably
about 16MB or so each. Each cylinder group has an inode table and
data blocks.  For smaller files, it's highly likely that all the
data blocks for a file are in the cylinder group that its inode is

So you've probably lost the first two or three cylinder groups, but
you should be able to recover the rest.

The rubbish in the first 30MB of the disk may be confusing fsck. It
is probably worth dd'ing /dev/zero over that first 30mb, since we know
the stuff there is garbage anyway. Actually, make it 25 MB to be safe:

	dd if=/dev/zero of=/dev/rwd0a bs=8192 count=3200

(I assume that you only had one partition on your disk, a. If you
had more, all ofthese have to be recovered separately.)

Now you should be able to run fsck and let it recover what it can.
You will probably want to run it with the `-y' option, as otherwise
you'll spend the next six months typing `y' at your console. :-)

HOWEVER, there may be another problem here. I've now deleted the
original message, but if you overwrite /dev/wd0c, you've also
overwritten your boot blocks and disklabel, which are outside of
the filesystem. These need to be recovered first. There's no real
way to recover a disklabel, unfortunately, so you'd have to recreate
it. This may mean doing it from memory. If you didn't actually look
at the disklabel, but just used whatever the NetBSD install put on
your disk, you could re-run the install to the disklabel point,
but kill it before it tries to newfs your filesystem.

Now note that I've not actually tried this. However, I was going
to pick up another Jaz disk soon, so if you don't feel confident
that you understand what I've just said above, and you want me to
try it to see what sort of glitches one might run in to, wait a
couple of days and I'll create a new filesystem, blow it up the
way you did yours, and then try to fix it up and see what happens.

If you're really desperate and need advice right away, do feel free
to ring me on the number below during business hours, PDT.


Curt Sampson		Info at
Internet Portal Services, Inc.	
Vancouver, BC   (604) 257-9400		De gustibus, aut bene aut nihil.