Subject: Lost my inodes
To: None <netbsd-users@netbsd.org>
From: Richard M Kreuter <kreuter@progn.net>
List: netbsd-users
Date: 06/01/2005 11:30:40
Howdy,

Yesterday I ran out of inodes while untarring something, and after
clearing out a lot of temporary files, I noticed something fishy: the
number of files found by find and the number of used inodes reported
by df differ by a couple orders of magnitude on /home [1]:

# df -i /home
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/wd0j            12671998 12542780  129218   99% /home
# pwd
/home
# find . -xdev -ls | awk ' { print $1 } ' | sort -n | uniq | wc -l
218938

I'm running NetBSD 2.0.2, and /home is normally mounted softdep,
nodev, noatime.

That's the problem.  Here's a possible explanation, but I'm not sure
if this is the cause: last week, after a crash, fsck on my /home file
system printed this message for at least a few thousand integers <N>:

ALLOCATED INODE <N> MARKED FREE

After it finished, by investigation, no files seemed to have been
lost, and I didn't have time to do look into it.  Now I can't find the
meaning of this message documented anyplace, and the code in
src/sbin/fsck_ffs/pass5.c where this message seems to originate
doesn't mean much to me.

Anyhow, can I do anything other than dump, recreate, and undump the
file system to get the inodes back?

Thank you,
Richard Kreuter

[1] Counting files this way for other file systems and comparing to
`df -i` gives these results:

File system  Inodes used  Files found  Difference     Ratio
/                   2486         2477           9   1.00363
/usr               19451        19448           3   1.00015
/var               22508        22505           3   1.00013
/usr/pkg           35497        35497           0         1
/usr/local         26963        26963           0         1
/usr/src          143599       143599           0         1
/home           12542784       218941    12323843   57.2884