[Baypiggies] Number of inodes on a volume?
Jesse Gough
jesse_gough at symantec.com
Wed Feb 3 02:29:01 CET 2010
On Tue, 02 Feb 2010, Glen Jarvis wrote:
> I have a quick question to this brilliant group :)
>
> How do I, using pure python, get the number of inodes free on a volume
> for a particular mount?
>
> Basically, is there an equivalent to df -i in Python? Is this
> somewhere in stat and I can't find it?
os.statvfs() will do what you need. It's the "f_ffree" member. Pydoc
isn't so helpful there, but you can give meaning to the statvfs_result
attributes by looking at 'man statfs':
struct statfs {
long f_type; /* type of file system (see below) */
long f_bsize; /* optimal transfer block size */
long f_blocks; /* total data blocks in file system */
long f_bfree; /* free blocks in fs */
long f_bavail; /* free blocks avail to non-superuser */
long f_files; /* total file nodes in file system */
long f_ffree; /* free file nodes in fs */
fsid_t f_fsid; /* file system id */
long f_namelen; /* maximum length of filenames */
};
-Jesse
More information about the Baypiggies
mailing list