Operating System - HP-UX
1753611 Members
6053 Online
108797 Solutions
New Discussion

Re: Need explanation about the fields returned by the statvfs call.

 
PrasannaKumari
Contributor

Need explanation about the fields returned by the statvfs call.

We are using the statvfs call for getting the file system information. The following fields of the statvfs data structure are being used.


- f_blocks
- f_bfree
- f_bavail
- f_frsize

We are calculating the file system size by getting product of f_blocks and f_frsize
.

The available size is being calculated using f_bavail * f_frsize.

The used space is being calculated using (f_blocks - f_bfree ) * f_frsize.


My observation is that the addition of this available size and the used space which should give the total file system size is different from total file system size calcluated using (f_blocks * f_frsize).

Can you please let me know the reason for this?


1 REPLY 1
Matti_Kurkela
Honored Contributor

Re: Need explanation about the fields returned by the statvfs call.

Type "man statvfs" to get a description of the fields.

Note that f_bavail is "blocks available to _non-superuser_" (emphasis mine) while f_bfree is the number of free blocks. These numbers may or may not be equal: with some filesystems, some space may be reserved for superuser only, so that root can move things around even when the filesystem is "full" for normal users.

MK
MK