[comp.bugs.sys5] Too many inodes

hybl@mbph.UUCP (Albert Hybl Dept of Biophysics SM) (11/01/88)

I have been using (umount; fsck -y -s; mount) as a hacked fix for
the Alzheimer's Syndrome that was occurring on /usr4, the file system
containing our news directories.  These commands are being executed
from a demon script that is run daily by the cron.  Since we began
using it, no inodes have been reported lost. 

From time to time I have run (du -a /usr4 | wc -l) to count
the number of files/directories being used.  This number should
be equal to the number of inodes in use.  When added to the number
of available inodes reported by the command (df /usr4), the sum
should equal the total inodes for the file system.  This was the
case before the demon script was activated.

Since the activation of the demon script, the du|wc generated
value has been too large and is getting larger each time it is
computed.  For example, today fsck reports that 5976 files are
being used; df says that 216 inodes are available and hence
there are a total of 6192 inodes assigned to the file system.
That is as it should be.  However, the du|wc count reports 6368
files/directories!

Can anyone explain why du|wc is not counting correctly.  Is this
another sysV_bug?  Is it safe-harmless or does it portend trouble?

----------------------------------------------------------------------
Albert Hybl, PhD.              Office UUCP: uunet!mimsy!mbph!hybl
Department of Biophysics       Home   UUCP: uunet!mimsy!mbph!hybl!ah
University of Maryland                CoSy: ahybl
School of Medicine
Baltimore, MD  21201                 Phone: (301) 328-7940 (Office)
----------------------------------------------------------------------

ditto@cbmvax.UUCP (Michael "Ford" Ditto) (11/02/88)

In article <580@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl  Dept of Biophysics  SM) writes:
>there are a total of 6192 inodes assigned to the file system.
>That is as it should be.  However, the du|wc count reports 6368
>files/directories!

"du -a" will count each link (directory entry) once, even if it refers
to an inode that was already counted, thus for every file that has two
links, your "du -a|wc -l" will be off by one (and off by two for each
3-link file, etc.).

In the news spool directory, multiple links are used when articles are
crossposted.
-- 
					-=] Ford [=-

"The number of Unix installations	(In Real Life:  Mike Ditto)
has grown to 10, with more expected."	ford@kenobi.cts.com
- The Unix Programmer's Manual,		...!sdcsvax!crash!elgar!ford
  2nd Edition, June, 1972.		ditto@cbmvax.commodore.com

nyssa@terminus.UUCP (The Prime Minister) (11/03/88)

In article <580@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl  Dept of Biophysics  SM) writes:
<Since the activation of the demon script, the du|wc generated
<value has been too large and is getting larger each time it is
<computed.  For example, today fsck reports that 5976 files are
<being used; df says that 216 inodes are available and hence
<there are a total of 6192 inodes assigned to the file system.
<That is as it should be.  However, the du|wc count reports 6368
<files/directories!
<
<Can anyone explain why du|wc is not counting correctly.  Is this
<another sysV_bug?  Is it safe-harmless or does it portend trouble?

LINKS!!!

ron@motmpl.UUCP (Ron Widell) (11/04/88)

Note- followup's directed to comp.bugs.sys5

In article <5167@cbmvax.UUCP> ditto@cbmvax.UUCP (Michael "Ford" Ditto) writes:
>In article <580@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl  Dept of Biophysics  SM) writes:
>>there are a total of 6192 inodes assigned to the file system.
>>That is as it should be.  However, the du|wc count reports 6368
>>files/directories!
>
>"du -a" will count each link (directory entry) once, even if it refers
>to an inode that was already counted, thus for every file that has two
>links, your "du -a|wc -l" will be off by one (and off by two for each
>3-link file, etc.).
>
>In the news spool directory, multiple links are used when articles are
>crossposted.
>-- 
>					-=] Ford [=-
>
>"The number of Unix installations	(In Real Life:  Mike Ditto)
>has grown to 10, with more expected."	ford@kenobi.cts.com
>- The Unix Programmer's Manual,		...!sdcsvax!crash!elgar!ford
>  2nd Edition, June, 1972.		ditto@cbmvax.commodore.com

hmm, in looking at the description of du(1)  for both Vr2 and Vr3 I see:

"A file with two or more links is counted only once."

But then, looking at BUGS I see:
for Vr2- "If there are too many [not defined] distinct linked files,
du counts the excess files more than once."

and for Vr3- "If there are links between files in different directories where
the directories are on separate branches of the file system hierarchy, du will
count the excess files more than once."

So the problem *may* be due to the links, but maybe not.
It all depends ;-).

-- 
Ron Widell, Field Applications Eng.	|UUCP: motmpl!ron
Motorola Semiconductor Products, Inc.,	|Voice:(612)941-6800
9600 W. 76th St., Suite G		| If they *knew* what I was saying,
Eden Prairie, Mn. 55344 -3718		| do you think they'd let me say it?