Hello,

>From statvfs(3):

           struct statvfs {
               unsigned long  f_bsize;    /* file system block size */
               unsigned long  f_frsize;   /* fragment size */
               fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
               fsblkcnt_t     f_bfree;    /* # free blocks */
               fsblkcnt_t     f_bavail;   /* # free blocks for unprivileged 
users */
               ....
           }

So the size of a file system is f_blocks * f_frsize. For the
file system mounted at mnt, the values are

# python
>>> import os
>>> os.statvfs('mnt')
posix.statvfs_result(f_bsize=4, f_frsize=10485760, f_blocks=104857, 
f_bfree=104856, f_bavail=104856, f_files=1000000, f_ffree=999996, 
f_favail=999996, f_flag=4102, f_namemax=0)

So the file system size is 10485760 * 104857 = 1 TB. df, however, reports:

# df mnt
Filesystem                        1K-blocks  Used Available Use% Mounted on
local:///home/nikratio/tmp/bucket       410     1       410   1% 
/home/nikratio/tmp/mnt

# df --version
df (GNU coreutils) 8.13
[...]

This has apparently been calculated using f_bsize, since
f_bsize * f_blocks = 409k.


The same problem applies to f_bfree and f_bavail. I believe that in all cases, 
df should
use f_frsize rather than f_bsize to calculate the size in bytes.

Am I missing something?

Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C



Reply via email to