Subject: Re: any way to restore a "broken" directory?
To: None <netbsd-help@NetBSD.org>
From: henry nelson <netb@irm.nara.kindai.ac.jp>
List: netbsd-help
Date: 10/21/2003 15:52:12
On Mon, Oct 20, 2003 at 11:48:35PM +0200, Manuel Bouyer wrote:
> On Mon, Oct 20, 2003 at 10:25:41AM +0900, henry nelson wrote:
> > Logged in this morning and found my mail in a shambles.  Seems that the
> > directory where I had procmail delivering my mail to was somehow "broken."
[...]
> > Can't do anything in the directory like "ls" -- just a "click-click-click"
> > twice as if it's attempting a seek, and then a message "Input/output error."
[...]
> > Time to replace the disk, but is there anything that can be done to salvage
> > this one directory?  (All the other directories seem fine.)
> 
> I would try a dd conf=noerror,sync of that partition to a known good disk,
> and the fsck to hopefully get the files in /lost+found

Thanks; the "dd" part was what I was looking for, but for the life of me
I couldn't remember what the options were.

All I can say is, "WHEW!"  To share my close call, if you ever experience
something like a directory becoming dysfunctional in the manner described
above, then IMMEDIATELY get all files off of that disk.  All that was
available to me right away was ftp, but that turned out to be a life saver.
I got everything off in the nick of time.  After I had backed up the
undamaged portions, I logged in again, and started to edit some files to
see if there wasn't some way I could restore mail delivery by changing
settings in .muttrc and .cshrc -- it was then that I discovered that files
were corroding away before my very eyes.  Vi couldn't save things intact,
and new directories I had created were acting up.  I stopped fooling around
and logged out.  From the console as root I did an fsck in place since I
didn't think about dd, and didn't have an hdd large enough to hold the whole
partition anyway.  With immense luck the most important files turned out
to be repairable and all but a few files were in /lost+found.  If you've
never done it before, the files are named #nnnnnnn, where n is an integer.
I ftp'd those off, too, and then unmounted and powered off the drive.

Important thing to remember is to get intact files to a safe place as soon
as possible.  Later worry about salvaging damaged stuff.

I'm on a new disk now.  It's amazing how quiet it is -- I hadn't noticed how
over time the disk that went bad had begun making quite a racket.

henry