Subject: stat (thus du) too optimistic on disk usage
From: [email-masked] (Alex Martelli)

14 Sep 1997 09:26:27 -0700
Message-ID: <m0xAHH5-000glKC.cygnus.gnu-win32@axpblib>
Content-Type: text
To: [email-masked]

Hello,
I'm using b18 and it seems to me like stat is far too optimistic
regarding disk usage by a given file -- it seems to believe that
a small disk file may occupy just 512 or 1024 bytes of disk space,
while depending on the filesystem it could be taking up 16K or
even 32k (particularly if one has a FAT filesystem...).

Sample case: on a FAT filesystem, make a directory with 7 files
of a few bytes each and run du -k on it; it will claim 7 kB are
being taken, while in fact something like 7*16 or 7*32 might be.

The problem of too-large granularity of disk space occupation
being common in older Unix filesystems too, I would expect du
to be able to compensate for this misreporting (e.g. with a
command line switch to inform it of the actual blocksize), but
it seems to be trusting stat blindly.  So maybe the stat
"syscall" should be fixed, leaving du alone?

I tried rooting around in syscalls.cc and some attempt _is_
apparent to get the "real" blocksize, but apparently it must
be failing undetectedly... any suggestion?

Alex
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".