[Tutor] Mount size

Faulconer, Steven M. STEVEN.M.FAULCONER at saic.com
Wed Oct 27 23:33:55 CEST 2004


Hello everyone,

We are having some issues getting reliable information for available disk
space within Python programs. We are using os.statvfs to get the blocks
free, but the numbers are not consistent between local and NFS mounted
drives. For instance, system A returns a given size for the f_bavail while
system B returns exactly twice that number. The drive in question is local
on system A and NFS v3 mounted on System B. On system A, f_bavail actually
returns the exact kilobyte value for the available size for the drive in
question. System B gets exactly double.

On another system, I can't seem to correlate the value of f_bavail to the
actual amount of storage available. Given that f_bavail is the number of
blocks available (non-superuser) I would assume that we could multiply that
by f_bsize and then divide by 1 million (for megabytes) or 1 billion
(gigabytes). However, on none of the test systems does that return anything
close to what it should be.

All systems in question are running Solaris (8 or 9) and Python 2.3.2. I
imagine I missed a detail or something, so please let me know if you need
more information. If you have a recommended method for finding disk
usage/available that works for local and NFS mounted systems, I'd love to
see it.

Thanks.

Steven


More information about the Tutor mailing list