跳转到主要内容

pg_statvfs

Server filesystem capacity and inode statistics through statvfs

pg_statvfs : Server filesystem capacity and inode statistics through statvfs

Overview

ID Extension Package Version Category License Language
6470 pg_statvfs pg_statvfs 1.0 STAT PostgreSQL C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r No Yes No Yes yes no
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

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 1.0 18 17 16 15 14 pg_statvfs -
RPM PIGSTY 1.0 18 17 16 15 14 pg_statvfs_$v -
DEB PIGSTY 1.0 18 17 16 15 14 postgresql-$v-pg-statvfs -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
el8.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
el9.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
el9.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
el10.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
el10.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
d12.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
d12.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
d13.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
d13.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u22.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u22.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u24.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u24.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u26.x86_64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
u26.aarch64 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0 PIGSTY 1.0
Package Version OS ORG SIZE File URL
pg_statvfs_18 1.0 el8.x86_64 pigsty 20.4 KiB pg_statvfs_18-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_18 1.0 el8.aarch64 pigsty 20.4 KiB pg_statvfs_18-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_18 1.0 el9.x86_64 pigsty 20.6 KiB pg_statvfs_18-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_18 1.0 el9.aarch64 pigsty 20.5 KiB pg_statvfs_18-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_18 1.0 el10.x86_64 pigsty 20.6 KiB pg_statvfs_18-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_18 1.0 el10.aarch64 pigsty 20.8 KiB pg_statvfs_18-1.0-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-statvfs 1.0 d12.x86_64 pigsty 11.3 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-statvfs 1.0 d12.aarch64 pigsty 11.2 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-statvfs 1.0 d13.x86_64 pigsty 11.3 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-18-pg-statvfs 1.0 d13.aarch64 pigsty 11.2 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-18-pg-statvfs 1.0 u22.x86_64 pigsty 11.7 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-18-pg-statvfs 1.0 u22.aarch64 pigsty 11.5 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-18-pg-statvfs 1.0 u24.x86_64 pigsty 11.8 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-18-pg-statvfs 1.0 u24.aarch64 pigsty 11.6 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-18-pg-statvfs 1.0 u26.x86_64 pigsty 11.7 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-18-pg-statvfs 1.0 u26.aarch64 pigsty 11.7 KiB postgresql-18-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_statvfs_17 1.0 el8.x86_64 pigsty 20.4 KiB pg_statvfs_17-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_17 1.0 el8.aarch64 pigsty 20.4 KiB pg_statvfs_17-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_17 1.0 el9.x86_64 pigsty 20.5 KiB pg_statvfs_17-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_17 1.0 el9.aarch64 pigsty 20.5 KiB pg_statvfs_17-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_17 1.0 el10.x86_64 pigsty 20.6 KiB pg_statvfs_17-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_17 1.0 el10.aarch64 pigsty 20.8 KiB pg_statvfs_17-1.0-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-statvfs 1.0 d12.x86_64 pigsty 11.3 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-statvfs 1.0 d12.aarch64 pigsty 11.2 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-statvfs 1.0 d13.x86_64 pigsty 11.3 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-17-pg-statvfs 1.0 d13.aarch64 pigsty 11.2 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-17-pg-statvfs 1.0 u22.x86_64 pigsty 12.3 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-17-pg-statvfs 1.0 u22.aarch64 pigsty 12.2 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-17-pg-statvfs 1.0 u24.x86_64 pigsty 11.8 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-17-pg-statvfs 1.0 u24.aarch64 pigsty 11.6 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-17-pg-statvfs 1.0 u26.x86_64 pigsty 11.7 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-17-pg-statvfs 1.0 u26.aarch64 pigsty 11.7 KiB postgresql-17-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_statvfs_16 1.0 el8.x86_64 pigsty 20.3 KiB pg_statvfs_16-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_16 1.0 el8.aarch64 pigsty 20.4 KiB pg_statvfs_16-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_16 1.0 el9.x86_64 pigsty 20.5 KiB pg_statvfs_16-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_16 1.0 el9.aarch64 pigsty 20.5 KiB pg_statvfs_16-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_16 1.0 el10.x86_64 pigsty 20.6 KiB pg_statvfs_16-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_16 1.0 el10.aarch64 pigsty 20.8 KiB pg_statvfs_16-1.0-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-statvfs 1.0 d12.x86_64 pigsty 11.3 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-statvfs 1.0 d12.aarch64 pigsty 11.2 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-statvfs 1.0 d13.x86_64 pigsty 11.3 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-16-pg-statvfs 1.0 d13.aarch64 pigsty 11.2 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-16-pg-statvfs 1.0 u22.x86_64 pigsty 12.3 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-16-pg-statvfs 1.0 u22.aarch64 pigsty 12.2 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-16-pg-statvfs 1.0 u24.x86_64 pigsty 11.8 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-16-pg-statvfs 1.0 u24.aarch64 pigsty 11.6 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-16-pg-statvfs 1.0 u26.x86_64 pigsty 11.7 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-16-pg-statvfs 1.0 u26.aarch64 pigsty 11.7 KiB postgresql-16-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_statvfs_15 1.0 el8.x86_64 pigsty 20.4 KiB pg_statvfs_15-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_15 1.0 el8.aarch64 pigsty 20.4 KiB pg_statvfs_15-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_15 1.0 el9.x86_64 pigsty 20.5 KiB pg_statvfs_15-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_15 1.0 el9.aarch64 pigsty 20.5 KiB pg_statvfs_15-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_15 1.0 el10.x86_64 pigsty 20.6 KiB pg_statvfs_15-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_15 1.0 el10.aarch64 pigsty 20.8 KiB pg_statvfs_15-1.0-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-statvfs 1.0 d12.x86_64 pigsty 11.3 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-statvfs 1.0 d12.aarch64 pigsty 11.2 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-statvfs 1.0 d13.x86_64 pigsty 11.3 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-15-pg-statvfs 1.0 d13.aarch64 pigsty 11.2 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-15-pg-statvfs 1.0 u22.x86_64 pigsty 12.3 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-15-pg-statvfs 1.0 u22.aarch64 pigsty 12.2 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-15-pg-statvfs 1.0 u24.x86_64 pigsty 11.8 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-15-pg-statvfs 1.0 u24.aarch64 pigsty 11.6 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-15-pg-statvfs 1.0 u26.x86_64 pigsty 11.7 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-15-pg-statvfs 1.0 u26.aarch64 pigsty 11.7 KiB postgresql-15-pg-statvfs_1.0-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_statvfs_14 1.0 el8.x86_64 pigsty 20.3 KiB pg_statvfs_14-1.0-1PGSTY.el8.x86_64.rpm
pg_statvfs_14 1.0 el8.aarch64 pigsty 20.4 KiB pg_statvfs_14-1.0-1PGSTY.el8.aarch64.rpm
pg_statvfs_14 1.0 el9.x86_64 pigsty 20.5 KiB pg_statvfs_14-1.0-1PGSTY.el9.x86_64.rpm
pg_statvfs_14 1.0 el9.aarch64 pigsty 20.5 KiB pg_statvfs_14-1.0-1PGSTY.el9.aarch64.rpm
pg_statvfs_14 1.0 el10.x86_64 pigsty 20.6 KiB pg_statvfs_14-1.0-1PGSTY.el10.x86_64.rpm
pg_statvfs_14 1.0 el10.aarch64 pigsty 20.7 KiB pg_statvfs_14-1.0-1PGSTY.el10.aarch64.rpm
postgresql-14-pg-statvfs 1.0 d12.x86_64 pigsty 11.9 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~bookworm_amd64.deb
postgresql-14-pg-statvfs 1.0 d12.aarch64 pigsty 11.7 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~bookworm_arm64.deb
postgresql-14-pg-statvfs 1.0 d13.x86_64 pigsty 11.9 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~trixie_amd64.deb
postgresql-14-pg-statvfs 1.0 d13.aarch64 pigsty 11.8 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~trixie_arm64.deb
postgresql-14-pg-statvfs 1.0 u22.x86_64 pigsty 13.0 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~jammy_amd64.deb
postgresql-14-pg-statvfs 1.0 u22.aarch64 pigsty 12.8 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~jammy_arm64.deb
postgresql-14-pg-statvfs 1.0 u24.x86_64 pigsty 12.5 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~noble_amd64.deb
postgresql-14-pg-statvfs 1.0 u24.aarch64 pigsty 12.2 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~noble_arm64.deb
postgresql-14-pg-statvfs 1.0 u26.x86_64 pigsty 12.3 KiB postgresql-14-pg-statvfs_1.0-1PGSTY~resolute_amd64.deb
postgresql-14-pg-statvfs 1.0 u26.aarch64 pigsty 12.3 KiB postgresql-14-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 via package name, for the active PG version

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
pig install pg_statvfs -v 14;   # install for PG 14

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.