xref: /netbsd-src/share/man/man5/statvfs.5 (revision 6f8dc1509fa98d2f403ca646d8d47b18bead7044)
1*6f8dc150Sandvar.\"	$NetBSD: statvfs.5,v 1.16 2021/10/21 13:21:53 andvar Exp $
26bd1d6d4Schristos.\"
36bd1d6d4Schristos.\" Copyright (c) 1989, 1991, 1993
46bd1d6d4Schristos.\"	The Regents of the University of California.  All rights reserved.
56bd1d6d4Schristos.\"
66bd1d6d4Schristos.\" Redistribution and use in source and binary forms, with or without
76bd1d6d4Schristos.\" modification, are permitted provided that the following conditions
86bd1d6d4Schristos.\" are met:
96bd1d6d4Schristos.\" 1. Redistributions of source code must retain the above copyright
106bd1d6d4Schristos.\"    notice, this list of conditions and the following disclaimer.
116bd1d6d4Schristos.\" 2. Redistributions in binary form must reproduce the above copyright
126bd1d6d4Schristos.\"    notice, this list of conditions and the following disclaimer in the
136bd1d6d4Schristos.\"    documentation and/or other materials provided with the distribution.
146bd1d6d4Schristos.\" 3. Neither the name of the University nor the names of its contributors
156bd1d6d4Schristos.\"    may be used to endorse or promote products derived from this software
166bd1d6d4Schristos.\"    without specific prior written permission.
176bd1d6d4Schristos.\"
186bd1d6d4Schristos.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
196bd1d6d4Schristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
206bd1d6d4Schristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
216bd1d6d4Schristos.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
226bd1d6d4Schristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
236bd1d6d4Schristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
246bd1d6d4Schristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
256bd1d6d4Schristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
266bd1d6d4Schristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
276bd1d6d4Schristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
286bd1d6d4Schristos.\" SUCH DAMAGE.
296bd1d6d4Schristos.\"
306bd1d6d4Schristos.\"	@(#)statfs.2	8.5 (Berkeley) 5/24/95
316bd1d6d4Schristos.\"
3202cdd248Schristos.Dd September 22, 2019
336bd1d6d4Schristos.Dt STATVFS 5
346bd1d6d4Schristos.Os
356bd1d6d4Schristos.Sh NAME
366bd1d6d4Schristos.Nm statvfs
376bd1d6d4Schristos.Nd file system statistics
386bd1d6d4Schristos.Sh SYNOPSIS
396bd1d6d4Schristos.In sys/types.h
406bd1d6d4Schristos.In sys/statvfs.h
416bd1d6d4Schristos.Sh DESCRIPTION
426bd1d6d4SchristosThe
435e015e5eSjoerg.In sys/statvfs.h
446bd1d6d4Schristosheader defines the structures and functions that
456bd1d6d4Schristosreturn information about a mounted file system.
466bd1d6d4SchristosThe
476bd1d6d4Schristos.Nm statvfs
486bd1d6d4Schristosstructure is defined as follows:
496bd1d6d4Schristos.Bd -literal
506bd1d6d4Schristostypedef struct { int32_t val[2]; } fsid_t;	/* file system id type */
516bd1d6d4Schristos
526bd1d6d4Schristos#define VFS_NAMELEN  32 	/* length of fs type name, including nul */
536bd1d6d4Schristos#define VFS_MNAMELEN 1024	/* length of buffer for returned name */
546bd1d6d4Schristos
556bd1d6d4Schristosstruct statvfs {
566bd1d6d4Schristos    unsigned long f_flag;	/* copy of mount exported flags */
576bd1d6d4Schristos    unsigned long f_bsize;	/* system block size */
586bd1d6d4Schristos    unsigned long f_frsize;	/* system fragment size */
596bd1d6d4Schristos    unsigned long f_iosize;	/* optimal file system block size */
606bd1d6d4Schristos
619b08c42bSchristos    /* The following are in units of f_frsize */
629296855eSxtraeme    fsblkcnt_t	f_blocks;	/* number of blocks in file system */
636bd1d6d4Schristos    fsblkcnt_t	f_bfree;	/* free blocks avail in file system */
646bd1d6d4Schristos    fsblkcnt_t	f_bavail;	/* free blocks avail to non-root */
656bd1d6d4Schristos    fsblkcnt_t	f_bresvd;	/* blocks reserved for root */
666bd1d6d4Schristos
676bd1d6d4Schristos    fsfilcnt_t	f_files;	/* total file nodes in file system */
686bd1d6d4Schristos    fsfilcnt_t	f_ffree;	/* free file nodes in file system */
6902cdd248Schristos    fsfilcnt_t	f_favail	/* free file nodes avail to non-root */
706bd1d6d4Schristos    fsfilcnt_t	f_fresvd;	/* file nodes reserved for root */
716bd1d6d4Schristos
726bd1d6d4Schristos    uint64_t	f_syncreads;	/* count of sync reads since mount */
736bd1d6d4Schristos    uint64_t	f_syncwrites;	/* count of sync writes since mount */
746bd1d6d4Schristos
756bd1d6d4Schristos    uint64_t	f_asyncreads;	/* count of async reads since mount */
766bd1d6d4Schristos    uint64_t	f_asyncwrites;	/* count of async writes since mount */
776bd1d6d4Schristos
786bd1d6d4Schristos    unsigned long f_fsid;	/* POSIX compliant file system id */
796bd1d6d4Schristos    fsid_t	f_fsidx;	/* NetBSD compatible file system id */
806bd1d6d4Schristos
816bd1d6d4Schristos    unsigned long f_namemax;	/* maximum filename length */
826bd1d6d4Schristos    uid_t	f_owner;	/* user that mounted the file system */
836bd1d6d4Schristos
8402cdd248Schristos    uint64_t	f_spare[4];	/* spare space */
856bd1d6d4Schristos
866bd1d6d4Schristos    char f_fstypename[VFS_NAMELEN];	/* fs type name */
876bd1d6d4Schristos    char f_mntonname[VFS_MNAMELEN];	/* directory on which mounted */
886bd1d6d4Schristos    char f_mntfromname[VFS_MNAMELEN];	/* mounted file system */
8902cdd248Schristos    char f_mntfromlabel[_VFS_MNAMELEN];	/* disk label name if avail */
906bd1d6d4Schristos};
916bd1d6d4Schristos.Ed
926bd1d6d4Schristos.Pp
936bd1d6d4SchristosThe
946bd1d6d4Schristos.Fa f_flag
956bd1d6d4Schristosargument can have the following bits set:
966bd1d6d4Schristos.Bl -tag -width ST_SYNCHRONOUS
976bd1d6d4Schristos.It Dv ST_RDONLY
986bd1d6d4SchristosThe filesystem is mounted read-only;
996bd1d6d4SchristosEven the super-user may not write on it.
1006bd1d6d4Schristos.It Dv ST_NOEXEC
1016bd1d6d4SchristosFiles may not be executed from the filesystem.
1026bd1d6d4Schristos.It Dv ST_NOSUID
1036bd1d6d4SchristosSetuid and setgid bits on files are not honored when they are executed.
1046bd1d6d4Schristos.It Dv ST_NODEV
1056bd1d6d4SchristosSpecial files in the filesystem may not be opened.
1064bcc1eddSchristos.It Dv ST_UNION
1074bcc1eddSchristosUnion with underlying filesystem instead of obscuring it.
1086bd1d6d4Schristos.It Dv ST_SYNCHRONOUS
1096bd1d6d4SchristosAll I/O to the filesystem is done synchronously.
1106bd1d6d4Schristos.It Dv ST_ASYNC
1116bd1d6d4SchristosNo filesystem I/O is done synchronously.
1126bd1d6d4Schristos.It Dv ST_NOCOREDUMP
1136bd1d6d4SchristosDon't write core dumps to this file system.
1146bd1d6d4Schristos.It Dv ST_NOATIME
1156bd1d6d4SchristosNever update access times.
1166bd1d6d4Schristos.It Dv ST_SYMPERM
1176bd1d6d4SchristosRecognize symbolic link permission.
1186bd1d6d4Schristos.It Dv ST_NODEVMTIME
11995674936SwizNever update modification times for device files.
120d4b37902Sad.It Dv ST_LOG
121*6f8dc150SandvarUse logging (journaling).
1226bd1d6d4Schristos.It Dv ST_LOCAL
1236bd1d6d4SchristosThe filesystem resides locally.
1246bd1d6d4Schristos.It Dv ST_QUOTA
1256bd1d6d4SchristosThe filesystem has quotas enabled on it.
1266bd1d6d4Schristos.It Dv ST_ROOTFS
1276bd1d6d4SchristosIdentifies the root filesystem.
1286bd1d6d4Schristos.It Dv ST_EXRDONLY
1296bd1d6d4SchristosThe filesystem is exported read-only.
1306bd1d6d4Schristos.It Dv ST_EXPORTED
1316bd1d6d4SchristosThe filesystem is exported for both reading and writing.
1326bd1d6d4Schristos.It Dv ST_DEFEXPORTED
1336bd1d6d4SchristosThe filesystem is exported for both reading and writing to any Internet host.
1346bd1d6d4Schristos.It Dv ST_EXPORTANON
1356bd1d6d4SchristosThe filesystem maps all remote accesses to the anonymous user.
1366bd1d6d4Schristos.It Dv ST_EXKERB
1376bd1d6d4SchristosThe filesystem is exported with Kerberos uid mapping.
1386bd1d6d4Schristos.It Dv ST_EXNORESPORT
1396bd1d6d4SchristosDon't enforce reserved ports (NFS).
1406bd1d6d4Schristos.It Dv ST_EXPUBLIC
1416bd1d6d4SchristosPublic export (WebNFS).
1426bd1d6d4Schristos.El
1436bd1d6d4Schristos.Pp
14495674936SwizFields that are undefined for a particular file system are set to \-1.
1456bd1d6d4Schristos.Sh NOTES
1466bd1d6d4Schristos.Bl -tag -width f_bavail
1476bd1d6d4Schristos.It f_flag
1486bd1d6d4SchristosThe
1496bd1d6d4Schristos.Fa f_flag
1506bd1d6d4Schristosfield is the same as the
1516bd1d6d4Schristos.Fa f_flags
1526bd1d6d4Schristosfield in the
1536bd1d6d4Schristos.Bx 4.3
15453d98664Sabhinav.Ic statfs
1556bd1d6d4Schristossystem call.
1566bd1d6d4Schristos.It f_fsid
1576bd1d6d4SchristosIs defined to be
1586bd1d6d4Schristos.Ft unsigned long
1596bd1d6d4Schristosby the X/Open standard.
1606bd1d6d4SchristosUnfortunately this is not enough space to store our
1616bd1d6d4Schristos.Ft fsid_t ,
1626bd1d6d4Schristosso we define an additional
1636bd1d6d4Schristos.Fa f_fsidx
1646bd1d6d4Schristosfield.
1656bd1d6d4Schristos.It f_bavail
1666bd1d6d4SchristosCould historically be negative (in the
16753d98664Sabhinav.Ic statfs
1686bd1d6d4Schristossystem call) when the used space has exceeded
1696bd1d6d4Schristosthe non-superuser free space.
1706bd1d6d4SchristosIn order to comply with the X/Open standard, we have to define
1716bd1d6d4Schristos.Ft fsblkcnt_t
1726bd1d6d4Schristosas an unsigned type, so in all cases where
1736bd1d6d4Schristos.Fa f_bavail
1746bd1d6d4Schristoswould have been negative, we set it to 0.
1756bd1d6d4SchristosIn addition we provide
1766bd1d6d4Schristos.Fa f_bresvd
1776bd1d6d4Schristoswhich contains the amount of reserved blocks for the superuser, so
1786bd1d6d4Schristosthe old value of
1796bd1d6d4Schristos.Fa f_bavail
1806bd1d6d4Schristoscan be easily computed as:
1816bd1d6d4Schristos.Bd -literal
1826bd1d6d4Schristos	old_bavail = f_bfree - f_bresvd;
1836bd1d6d4Schristos.Ed
1846bd1d6d4Schristos.El
185b7841c72Skleink.Sh SEE ALSO
186b7841c72Skleink.Xr statvfs 2
1876bd1d6d4Schristos.Sh HISTORY
1886bd1d6d4SchristosThe
1895e015e5eSjoerg.In sys/statvfs.h
1906bd1d6d4Schristosheader first appeared in
1910fbb37dfSgendalia.Nx 3.0 .
192