Re: Getting total and free disk space from paths in PGDATA

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Getting total and free disk space from paths in PGDATA
Date: 2015-09-08 21:13:43
Message-ID: 2121786276.2343150.1441746823506.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(dot)paquier(at)gmail(dot)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(dot)EE98(dot)0025(dot)0(at)wicourts(dot)gov#43FDF6D0(dot)EE98(dot)0025(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2015-09-08 21:19:52 Re: pgsql: Improve logging of TAP tests.
Previous Message Robert Haas 2015-09-08 21:11:36 Re: why can the isolation tester handle only one waiting process?