Sean Carolan
2008-Aug-11 19:00 UTC
[CentOS] df to get total disk usage on all filesystems?
Is there a flag for the df command to get the total disk space used on all filesystems as one number? I have a server with a lot of mounted shares. I'm looking for a simple way to measure rate of data growth across all shares as one total value.
Stephen Harris
2008-Aug-11 19:06 UTC
[CentOS] df to get total disk usage on all filesystems?
> Is there a flag for the df command to get the total disk space used on > all filesystems as one number? I have a server with a lot of mounted > shares. I'm looking for a simple way to measure rate of data growth > across all shares as one total value.Not directly, but you can add up all the entries mounted from /dev with a simple awk statement: df -kl | awk '/^\/dev\// { avail += $3/1024 } END { printf("%d Mb used\n",avail)} ' -- rgds Stephen
Aleksey Tsalolikhin
2008-Aug-11 19:07 UTC
[CentOS] df to get total disk usage on all filesystems?
Dear Sean, No, there isn't. You'd have to parse the df output to get that value. I suggest using the -P switch to df, so you don't have to deal with multi-line output per filesystem. The following will return kilobytes of disk space used (third column in the df -kP output): df -kP |grep -v ^Filesystem |awk '{sum += $3} END { print sum; } ' Best, -at On 8/11/08, Sean Carolan <scarolan at gmail.com> wrote:> Is there a flag for the df command to get the total disk space used on > all filesystems as one number? I have a server with a lot of mounted > shares. I'm looking for a simple way to measure rate of data growth > across all shares as one total value. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >
Dirk H. Schulz
2008-Aug-11 19:36 UTC
[CentOS] df to get total disk usage on all filesystems?
As long as you only want the absolute amount of data (not the percentage of total file space that is used) you could use "du -sh /" on that server. --On 11. August 2008 14:00:09 -0500 Sean Carolan <scarolan at gmail.com> wrote:> Is there a flag for the df command to get the total disk space used on > all filesystems as one number? I have a server with a lot of mounted > shares. I'm looking for a simple way to measure rate of data growth > across all shares as one total value. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos
Spiro Harvey, Knossos Networks Ltd
2008-Aug-11 21:49 UTC
[CentOS] df to get total disk usage on all filesystems?
Sean Carolan wrote:> Is there a flag for the df command to get the total disk space used on > all filesystems as one number? I have a server with a lot of mounted > shares. I'm looking for a simple way to measure rate of data growth > across all shares as one total value.You've had a few replies as to the actual command(s) to use to achieve this, but what about looking at it from a different perspective? Is having one number useful for different data volumes? If one is a SQL database that remains static, and another is a shared disk used by the marketing department and its usage changes by gigs a week, then you're not really able to judge when a particular disk is going to need more capacity. One overall number has very limited use. Of course maybe that really is what you're after, in which case all this is redundant.. :) But another way to measure usage would be to feed the data daily (or weekly, or hourly, or whatever) into something like RRD Tool. Then it will come up with some pretty graphs of usage per disk. Then you can also calculate the total as well as another field, but I believe that separate data volumes warrant measuring separately. RRD Tool can be a bit complex to talk to directly, but if you use something like Cacti (http://www.cacti.net/), then I think you will get more value out of your data. I've never used Cacti myself, but it looks like a very nice package. And it makes talking to RRD Tool much easier. That and you can produce lots of pretty graphs for management that prove you need upgrades and more imortantly, *where*. :) -- Spiro Harvey Knossos Networks Ltd 021-295-1923 www.knossos.net.nz