Michael Paquier <michael.paquier@gmail.com> wrote:
> There is currently no in-core function to query the amount of
> available and free space in a path of PGDATA, with something like that
> for example:
> SELECT * FROM pg_get_diskspace_info('pg_xlog');
> total_space | free_space
> -------------+------------
> 4812 MB | 3925 MB
> (1 row)
>
> This would be definitely useful for monitoring purposes to have a look
> at the disk space bloat in PGDATA, pg_xlog, or even pg_log which are
> usually located on different partitions. Some of my customers have
> requested such a thing for a couple of times,
When I was working with Wisconsin Courts we needed something like
this, and wrote it. It has been used on hundreds of clusters,
24/7, for years. I see that the last publicly posted updated was
in 2008, but it likely never needed changes after that. We used it
on Windows and Linux. At the time, the community rather actively
rejected incorporating it, but maybe in today's world of extensions
it could be put on pgxn.org.
http://www.postgresql.org/message-id/flat/43FDF6D0.EE98.0025.0@wicourts.gov#43FDF6D0.EE98.0025.0@wicourts.gov
http://pgfoundry.org/projects/fsutil/
The license is BSD, so there should be no problem grabbing the source
and using as much (or as little) as you find helpful.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company