NAME

Filesys::Df - Perl extension for obtaining file system stats.

SYNOPSIS

use Filesys::Df;
$ref=df('/tmp');
print"Percent Full: $ref->{PER}\n";
print"Superuser Blocks: $ref->{BLOCKS}\n";
print"Superuser Blocks Used: $ref->{USED}\n";
print"Superuser Blocks Available: $ref->{BFREE}\n";
print"User Blocks: $ref->{USER_BLOCKS}\n";
print"User Blocks Used: $ref->{USER_USED}\n";
print"User Blocks Available: $ref->{BAVAIL}\n";

DESCRIPTION

This module will produce information on a file system for both the normal disk space and the amount reserved for the superuser. It contains one function df(), which takes a directory as the first argument and an optional second argument which will let you specify the block size for the output. Note that the inode values are not changed by the block size argument. The return value is a refrence to a hash.

The keys of intrest in this hash are:

PER Percent used. This is based on what the non-superuser will have available.

SU_BLOCKS or BLOCKS Total number of blocks on the file system.

USER_BLOCKS Total number of blocks for non-superuser.

SU_USED or USED Total number of used blocks by superuser.

USER_USED Total number of used blocks by non-superuser.

SU_BAVAIL or BFREE Total number of avaliable blocks to superuser.

USER_BAVAIL or BAVAIL Total number of avaliable blocks to non-superuser.

FPER Percent of inodes available to the non-superuser.

SU_FILES or FILES Total inodes in file system.

USER_FILES Total inodes for the non-superuser.

SU_FUSED or FUSED Total number of inodes used.

USER_FUSED Total number of inodes used by non-superuser.

SU_FAVAIL or FFREE Inodes available in file system.

USER_FAVAIL or FAVAIL Inodes available to non-superuser.

Most 'df' applications will print out the SU_BLOCKS or USER_BLOCKS, USER_BAVAIL, SU_USED, and the percent full. So you will probably end up using these values the most.

If the file system does not contain a diffrential in space for the superuser then the USER_ keys will contain the same values as the SU_ keys.

If there was an error df() will return undef and $! will have been set.

Requirements: Your system must contain statvfs(). You must be running perl.5003 or higher.

Note: The way the percent full is measured is based on what the HP-UX application 'bdf' returns. The 'bdf' application seems to round a bit different than 'df' does but I like 'bdf' so that is what I based the percentages on.

AUTHOR

Ian Guthrie IGuthrie@aol.com

SEE ALSO

statvfs(2), df(1M), bdf(1M)

perl(1).