statvfs question

Levi Pearson levipearson at gmail.com
Wed Aug 11 10:26:39 MDT 2010


On Tue, Aug 10, 2010 at 6:03 PM, Mike Lovell <mike at dev-zero.net> wrote:
> i'm working on a program that uses a statvfs call to check the space
> free, space used, and total space on a filesystem. when looking through
> the docs for statvfs, i see that there is f_bsize and f_frsize that
> define block size and 'fundamental file system block size' or fragment
> size. it also has f_blocks which is the number of f_frsize units in the
> file system. i'm wondering about the f_bfree and f_bavail numbers
> though. are these supposed to be in terms of f_bsize or f_frsize? since
> its talking about blocks with these items and some of the docs refer to
> f_frsize as fragment size, i'm guessing that they are in terms of
> f_bsize. but it doesn't seem all that clear to me. anyone know for sure
> what this is supposed to be? thanks.

The f_frsize value is the actual minimum allocation unit of the
filesystem, while the f_bsize is the block size that would lead to
most efficient use of the disk with io calls.  All of the block counts
are in terms of f_frsize, since it is the actual allocation unit size.
 The BSD manpages are a bit more informative on this function than the
POSIX ones.

        --Levi


More information about the PLUG mailing list