Subject: Re: FFS in inconsistent state, fsck didn't complain
To: Arto Huusko <arto.huusko@utu.fi>
From: Luke Mewburn <lukem@netbsd.org>
List: netbsd-users
Date: 11/01/2001 11:49:49
On Wed, Oct 31, 2001 at 06:45:05PM +0200, Arto Huusko wrote:
> 
> So, I managed to get one of my FFS partitions into a bit
> inconsistent state. Actually, I ended up with one badly
> damaged file in my CVS repositry (thank God I had backed up
> only yesterday)... but I thought this kind of thing shouldn't
> actually happen, or at least fsck would bail out.
> 
> What I did was accidentally reset (should disconnect the switch)
> my computer slightly after a CVS commit. The box booted up,
> and fsck finished succesfully. After doing some more stuff
> with CVS, I found that one of the files in the repositry was
> damaged.
> 
> I proceeded to examine the file, and found that it started
> up as it should, and after the actual end of the content the
> file should've had, parts of another file were catenated, and
> after that there was something which looked like shell code
> I certainly don't have anywhere in the repositry, and then
> some random data.
> 
> This is (still) 1.5, plain FFS (sync, no softdeps).

There have been a few fixes to fsck in -current since NetBSD 1.5.
I've asked for these to be pulled up to the netbsd-1-5 branch.
When that's done, you should update your sources to the head of the
netbsd-1-5 branch, build & install a new kernel, and then build a
new fsck.

I'm not sure if that will fix your specific problem, though.

(For what it's worth, it is possible to get data corruption that
fsck won't detect; disk have write caches and if the kernel thinks
that it has written data to the media which has just been stored in
the drive, and power is lost before its flushed, you might lose.)

Luke.