Skip to content

pg_statvfs

Server filesystem capacity and inode statistics through statvfs

pg_statvfs · Server filesystem capacity and inode statistics through statvfs

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
6470pg_statvfspg_statvfs1.0STATPostgreSQLC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno
Superuser-only; checks server paths under data/log-directory rules. No preload. PostgreSQL 14-18 verified in PGSTY builds; upstream declares no major-version matrix.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.019 18 17 16 15pg_statvfs-
RPMPIGSTY1.019 18 17 16 15pg_statvfs_$v-
DEBPIGSTY1.019 18 17 16 15postgresql-$v-pg-statvfs-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el8.aarch64N/APIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el9.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el9.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el10.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
el10.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d12.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d12.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d13.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
d13.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u22.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u22.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u24.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u24.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u26.x86_64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
u26.aarch64PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0PIGSTY 1.0
PackageVersionOSORGSIZEFile URL
pg_statvfs_191.0el9.x86_64pigsty20.5 KiBpg_statvfs_19-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_191.0el9.aarch64pigsty20.4 KiBpg_statvfs_19-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_191.0el10.x86_64pigsty20.7 KiBpg_statvfs_19-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_191.0el10.aarch64pigsty20.8 KiBpg_statvfs_19-1.0-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-statvfs1.0d12.x86_64pigsty12.0 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-statvfs1.0d12.aarch64pigsty11.8 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-statvfs1.0d13.x86_64pigsty11.9 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-19-pg-statvfs1.0d13.aarch64pigsty11.9 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-19-pg-statvfs1.0u22.x86_64pigsty12.4 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-19-pg-statvfs1.0u22.aarch64pigsty12.2 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-19-pg-statvfs1.0u24.x86_64pigsty12.5 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-19-pg-statvfs1.0u24.aarch64pigsty12.3 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-19-pg-statvfs1.0u26.x86_64pigsty12.4 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-19-pg-statvfs1.0u26.aarch64pigsty12.4 KiBpostgresql-19-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_statvfs_181.0el8.x86_64pigsty20.2 KiBpg_statvfs_18-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_181.0el8.aarch64pigsty20.2 KiBpg_statvfs_18-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_181.0el9.x86_64pigsty20.5 KiBpg_statvfs_18-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_181.0el9.aarch64pigsty20.4 KiBpg_statvfs_18-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_181.0el10.x86_64pigsty20.7 KiBpg_statvfs_18-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_181.0el10.aarch64pigsty20.8 KiBpg_statvfs_18-1.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-statvfs1.0d12.x86_64pigsty11.9 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-statvfs1.0d12.aarch64pigsty11.8 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-statvfs1.0d13.x86_64pigsty11.9 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-statvfs1.0d13.aarch64pigsty11.9 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-statvfs1.0u22.x86_64pigsty12.3 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-statvfs1.0u22.aarch64pigsty12.2 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-statvfs1.0u24.x86_64pigsty12.5 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-statvfs1.0u24.aarch64pigsty12.3 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-statvfs1.0u26.x86_64pigsty12.4 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-statvfs1.0u26.aarch64pigsty12.4 KiBpostgresql-18-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_statvfs_171.0el8.x86_64pigsty20.2 KiBpg_statvfs_17-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_171.0el8.aarch64pigsty20.1 KiBpg_statvfs_17-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_171.0el9.x86_64pigsty20.5 KiBpg_statvfs_17-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_171.0el9.aarch64pigsty20.4 KiBpg_statvfs_17-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_171.0el10.x86_64pigsty20.6 KiBpg_statvfs_17-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_171.0el10.aarch64pigsty20.8 KiBpg_statvfs_17-1.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-statvfs1.0d12.x86_64pigsty11.9 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-statvfs1.0d12.aarch64pigsty11.8 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-statvfs1.0d13.x86_64pigsty11.9 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-statvfs1.0d13.aarch64pigsty11.8 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-statvfs1.0u22.x86_64pigsty13.0 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-statvfs1.0u22.aarch64pigsty12.9 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-statvfs1.0u24.x86_64pigsty12.5 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-statvfs1.0u24.aarch64pigsty12.2 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-statvfs1.0u26.x86_64pigsty12.4 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-statvfs1.0u26.aarch64pigsty12.4 KiBpostgresql-17-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_statvfs_161.0el8.x86_64pigsty20.2 KiBpg_statvfs_16-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_161.0el8.aarch64pigsty20.1 KiBpg_statvfs_16-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_161.0el9.x86_64pigsty20.4 KiBpg_statvfs_16-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_161.0el9.aarch64pigsty20.5 KiBpg_statvfs_16-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_161.0el10.x86_64pigsty20.6 KiBpg_statvfs_16-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_161.0el10.aarch64pigsty20.7 KiBpg_statvfs_16-1.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-statvfs1.0d12.x86_64pigsty11.9 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-statvfs1.0d12.aarch64pigsty11.8 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-statvfs1.0d13.x86_64pigsty11.9 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-statvfs1.0d13.aarch64pigsty11.8 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-statvfs1.0u22.x86_64pigsty13.0 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-statvfs1.0u22.aarch64pigsty12.9 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-statvfs1.0u24.x86_64pigsty12.5 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-statvfs1.0u24.aarch64pigsty12.2 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-statvfs1.0u26.x86_64pigsty12.4 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-statvfs1.0u26.aarch64pigsty12.4 KiBpostgresql-16-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_statvfs_151.0el8.x86_64pigsty20.2 KiBpg_statvfs_15-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_151.0el8.aarch64pigsty20.1 KiBpg_statvfs_15-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_151.0el9.x86_64pigsty20.5 KiBpg_statvfs_15-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_151.0el9.aarch64pigsty20.4 KiBpg_statvfs_15-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_151.0el10.x86_64pigsty20.6 KiBpg_statvfs_15-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_151.0el10.aarch64pigsty20.8 KiBpg_statvfs_15-1.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-statvfs1.0d12.x86_64pigsty11.9 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-statvfs1.0d12.aarch64pigsty11.8 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-statvfs1.0d13.x86_64pigsty11.9 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-15-pg-statvfs1.0d13.aarch64pigsty11.8 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-15-pg-statvfs1.0u22.x86_64pigsty13.0 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-15-pg-statvfs1.0u22.aarch64pigsty12.9 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-15-pg-statvfs1.0u24.x86_64pigsty12.5 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-15-pg-statvfs1.0u24.aarch64pigsty12.2 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-15-pg-statvfs1.0u26.x86_64pigsty12.4 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-15-pg-statvfs1.0u26.aarch64pigsty12.4 KiBpostgresql-15-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb

Source

github.com/michaelpq/pg_plugins/tree/ae57c1f3df697fb942f4576f873a655187193ace/pg_statvfs

pig build pkg pg_statvfs;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_statvfs;		# install by package name

pig install pg_statvfs -v 19;   # install for PG 19
pig install pg_statvfs -v 18;   # install for PG 18
pig install pg_statvfs -v 17;   # install for PG 17
pig install pg_statvfs -v 16;   # install for PG 16
pig install pg_statvfs -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pg_statvfs;

Usage

Sources:

pg_statvfs 1.0 exposes filesystem capacity, inode availability, and mount flags through the server’s statvfs call. It inspects the filesystem containing a server-side path, not a client directory or the size of an individual relation.

Core Workflow

After installing the extension files, use a superuser session:

CREATE EXTENSION pg_statvfs;
SELECT * FROM pg_statvfs(current_setting('data_directory'));
SELECT f_frsize * f_blocks AS total_bytes,
       f_frsize * f_bavail AS available_bytes
FROM pg_statvfs(current_setting('data_directory'));

Result and Access

pg_statvfs(path text) returns one record. f_bsize is the preferred block size; f_frsize is the unit for block counts. f_blocks, f_bfree, and f_bavail report total, free, and unprivileged-available blocks. f_files, f_ffree, and f_favail describe inode counts; f_fsid, f_namemax, and flags expose filesystem identity, name limits, and supported mount flags.

The C function explicitly requires superuser privileges and validates the path before asking the operating system. Missing or inaccessible paths produce an error. The extension needs no preload or restart of its own. Its control file permits relocation, but does not mark it trusted. The upstream subdirectory does not declare a complete PostgreSQL-major compatibility matrix; operating-system support and mount-flag coverage also vary.

Table reader