Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to check the disk free space in mu RHEL/Centos box. If I use df, sometimes, the command just hangs. (because of NFS issue or something)

I want to create a monitoring script and want to monitor disk free space usage. I do not want to use df, as it could hang.

I thought about "tune2fs -l" but the values does not match the output from "df"

how do i get the free disk space without using df?

Thanks in Advance Vijay

share|improve this question
1  
how about "stat -f /" or whatever mount point. stat -f / File: "/" ID: 0 Namelen: 255 Type: ext2/ext3 Blocks: Total: 5201804 Free: 3507293 Available: 3245133 Size: 4096 Inodes: Total: 1313760 Free: 994569 The output is in bytes, if you want to parse it the better way see man page for stat. –  Danila Ladner Aug 22 '13 at 15:31

3 Answers 3

up vote 6 down vote accepted

If you have issues with remote FS you can try -l from df to show only local FS (without smb, nfs,...) ex.

df -hl
share|improve this answer

For monitoring, your answer is Nagios. You might need to solve the NFS issue to get ahead.

share|improve this answer
    
Agree with Nagios, but he may monitor only local filesystems through snmp or even scripts. And the NFS isn't an "issue", it's just df trying to get the information over the network and, depending on the size of the disks, hanging on while it counts up the statistics. –  fboaventura Aug 23 '13 at 7:20

If you have one particular filesystem type, you can also use -t:

$ df -P -t ext3
Filesystem              1024-blocks      Used Available Capacity Mounted on
/dev/mapper/system-root     2064208    383928   1575436      20% /
/dev/mapper/system-var      4128448   1601360   2317400      41% /var
/dev/mapper/system-usr     10321208   9241500    555500      95% /usr
/dev/mapper/system-srv      4128448   2957240    961496      76% /srv
/dev/mapper/system-opt      2567984   1926352    615556      76% /opt
/dev/sda2                    253871     54964    185800      23% /boot
/dev/mapper/system-home   190942900 168859288  20145164      90% /home
/dev/mapper/system-fast    82569904  66171404  12204452      85% /home/fast
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.