dce@mips.COM (David Elliott) (09/26/88)
Our system is based on SVR3, but has a BSD-based filesystem. Currently, if you run statfs() on an empty filesystem, f_blocks gives you the total number of blocks in the system, and f_bfree gives you the same number minus the "minfree" space (usually 10%). This means that if you do your math based on these numbers, an empty filesystem will appear to be 10% full. Are our values correct? What does the standard System V statfs do? Does System V have a notion of space that only the superuser can fill? -- David Elliott dce@mips.com or {ames,prls,pyramid,decwrl}!mips!dce
ka@june.cs.washington.edu (Kenneth Almquist) (09/30/88)
dce@mips.COM (David Elliott) asks: > Our system is based on SVR3, but has a BSD-based filesystem. > Currently, if you run statfs() on an empty filesystem, f_blocks gives > you the total number of blocks in the system, and f_bfree gives you the > same number minus the "minfree" space (usually 10%). This means that > if you do your math based on these numbers, an empty filesystem will > appear to be 10% full. > > Are our values correct? What does the standard System V statfs do? > Does System V have a notion of space that only the superuser can fill? System V does not have any notion of space that only the superuser can fill, but it does have space that cannot be used to store file data: the superblock, the inode space, and one unused block between the superblock and the inode space. (This unused block was introduced during the conversion from the 512 byte file system to the 1024 byte file system, apparently unintentionally.) I believe that these are included in the "total number of blocks" in the file system. If so, there is no file system independent way to calculate the percentage of free space in a file system under System V. Kenneth Almquist
sp@labtam.OZ (Stephen Prince) (09/30/88)
In article <3826@dunkshot.mips.COM>, dce@mips.COM (David Elliott) writes: > and f_bfree gives you the > same number minus the "minfree" space (usually 10%). This means that > if you do your math based on these numbers, an empty filesystem will > appear to be 10% full. But this "minfree" limit only applies to non-super-users. Do you report something different for super-user? > Are our values correct? Would like to know the answer to that also. Having just been through the exercise of porting the 4.3BSD file system to SVR3. > What does the standard System V statfs do? I'm not sure what you call standard, the 3 vols of SVID I have here, don't have anything to say on this system call. While the SVR3 Programmer's Reference Manual only makes reference in describing the returned structure: long f_blocks; /* Total number of blocks */ long f_bfree; /* Count of free blocks */ and looking at the source (fs/s5/s5sys3.c): f_blocks = the superblock field which gives the size in blocks of the _entire_ volume (s_fsize) f_bfree = superblock field which gives the _total_ free blocks (s_tfree). Since this point was not clarified, I decided to take the approach used by the bsd version of df(1): f_blocks = # of data blocks in file system (fs_dsize) f_bfree = (# of free blocks) * (# frag/block) + (# free frag) of course the two values are converted to a 512 byte block size before returning. > Does System V have a notion of space that only the superuser can fill? Not in our SysV version from N.S. (Genix). /sp