VFS_STATFS(9)

πŸ’… VFS_STATFS(9) β€” it's giving kernel developer's manual ✨

okay so bestie, welcome to VFS_STATFS(9), section 9 of the Kernel Developer's Manual. this is the page where we spill the tea on how the kernel peeks at a file system and reports back everything it knows. no cap. 🫢


🌸 NAME 🌸

VFS_STATFS β€” return file system status πŸ’–


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/mount.h>
#include <sys/vnode.h>

int
VFS_STATFS(struct mount *mp, struct statfs *sbp);

πŸŽ€ DESCRIPTION πŸŽ€

The VFS_STATFS() macro returns various pieces of information about the file system, including recommended I/O sizes, free space, free inodes, etc. like it's literally the receipts of your filesystem, periodt. πŸ’…

The arguments it expects are:

  • mp β€” The file system. (the main character we're asking about πŸ‘‘)
  • sbp β€” A statfs structure, as defined by <sys/mount.h>, into which information is placed about the file system. (this is where the answers get dropped off πŸŽ€)

The fields of struct statfs related to the file system are as follows:

  • f_type β€” Type of file system.
  • f_flags β€” A copy of mount exported flags.
  • f_bsize β€” Fragment size.
  • f_iosize β€” Optimal transfer block size.
  • f_blocks β€” The total number of data blocks in the file system.
  • f_bfree β€” The number of free blocks in the file system.
  • f_bavail β€” The number of free blocks available to non-superuser processes.
  • f_files β€” The total number of file nodes in the file system.
  • f_ffree β€” The number of free nodes available to non-superuser processes.
  • f_syncwrites β€” The number of synchronous writes since the file system was mounted.
  • f_asyncwrites β€” The number of asynchronous writes since the file system was mounted.
  • f_syncreads β€” The number of synchronous reads since the file system was mounted.
  • f_asyncreads β€” The number of asynchronous reads since the file system was mounted.
  • f_namemax β€” The maximum file name length for this file system.
  • f_owner β€” The user ID of the user that mounted the file system.
  • f_fsid β€” Unique file system ID.
  • f_fstypename β€” The file system type name; a string of at most MFSNAMELEN bytes.
  • f_mntfromname β€” The device name the file system was mounted from; a string of at most MNAMELEN bytes.
  • f_mntonname β€” The name of the directory on which the file system is mounted; a string of at most MNAMELEN bytes.
ngl the way that struct is just ✨full✨ of lore. every field is a little piece of the filesystem's autobiography fr fr. πŸ¦‹

🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Doug Rabson. iconic behaviour honestly, we stan a manpage author πŸ’œ


okay bestie that's the whole vibe check βœ… this Debian edition dropped on May 23, 2009 and it still eats, no crumbs. go forth and statfs responsibly. mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from