fsck is failing to clean a filesystem

Polytropon freebsd at edvax.de
Thu Feb 11 11:11:14 UTC 2016

On Wed, 10 Feb 2016 21:56:48 +1100 (EST), Ian Smith wrote:
> On Wed, 10 Feb 2016 10:22:36 +0100, Polytropon wrote:
>  > On Wed, 10 Feb 2016 20:11:03 +1100 (EST), Ian Smith wrote:
>  > > On Tue, 9 Feb 2016 22:10:14 -0800, Paul Beard wrote:
>  > > 
>  > > Well at least /usr/src is easily replaced.  Might be worth just deleting 
>  > > all that, though of course you need a read-write mount first .. perhaps
>  > > after booting from a memstick or live CD?
>  > 
>  > Which is still risky, assuming that the file system has not
>  > been marked clean.
> Absolutely.  I'm assuming that at this stage the choice is to newfs /usr 
> and restore backups, unless some magic spell turns up.  Once apparently 
> losing or damaging '..' from anywhere, you're pretty much in trouble.

Yes, running newfs on that particular file system should be the
easiest way to deal with a file system damage like that.

> Paul, another question: with /usr unmounted, is there anything in /usr ?

Hmmm... fsck /usr operates on the /usr partition (or to be
correct, on the device associated with it), but when the
mountpoint itself (the directory /usr, residing on /) is
"contamined", it might cause trouble later on, when the
partition has been mounted. So any mountpoint should be
checked for being an empty directory.

>  > > Just stabbing in the dark .. scrambled filesystems are the pits!
>  > 
>  > And a good occassion to read more about UFS (McKusick et al.) - to
>  > develop a better understanding of what's happening. :-)
> Good suggestion :)  I envy people who've got the time these days ..

I had the chance and opportunity to do so, when a massive
file system damage caused a significant data loss. This
drove me to this mailing list, and finally, I got _all_
my data back. The actual loss was a few hundred directory
names and a few thousand file names, which is not a big
problem thanks to file magic based sorting tools.

However, a good understanding of file system internals
is helpful to avoid excessive spendings on data recovery.
Sure, you can "trust the experts" and pay $5000-10,000,
and maybe they then say: "Sorry, norhing to recover",
or you can buy expensive software for "trial & error".
It finally boils down to a "money vs. time" consideration.
I decided to invest my time to learn some UFS, and it
saved my ass. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list