[CentOS] df to get total disk usage on all filesystems?
Lunix1618
lunix1618 at gmail.com
Thu Aug 14 03:56:01 UTC 2008
Stephen Harris wrote:
> On Mon, Aug 11, 2008 at 12:07:09PM -0700, Aleksey Tsalolikhin wrote:
>
>> value. I suggest using the -P switch to df, so you don't have to deal
>> with multi-line output per filesystem.
>>
>
> Ugh, hasn't RedHat fixed that? Sun have (for a long time) automatically
> done this if stdout is not a terminal.
>
> *sigh*.
>
> So my previous mail should really be
> df -Pkl | awk '/^\/dev\// { avail += $3/1024 } END { printf("%d Mb used\n",avail)} '
>
Hi,
This is work well on my laptop that running Fedora 9 with no LVM but on
CentOS 5.2 with LVM it cann't calculate the LVM volume, below is output
of my system :
[root at centos-svr ~]# df -kPl
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/mapper/VolGroup00-LogVol00 274405432 18584656 241656808 8% /
/dev/sda2 101105 19096 76788 20% /boot
tmpfs 1682508 0 1682508 0% /dev/shm
and with the command of Stephen :
[root at centos-svr ~]# df -Pkl | awk '/^\/dev\// { avail += $3/1024 } END
{ printf("%d Mb used\n",avail)} '
18173 Mb used
So it seam to be bot calculated on /dev/mapper/VolGroup00-LogVol00
I am just a newbie with Linux and stupid enough to not to know how to
fix the command so just post it and hope you guys can improve the script ;)
Thanks for the tip.
Have fun.
regards,
More information about the CentOS
mailing list