1

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

1
  • 2
    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. Aug 22, 2013 at 15:31

3 Answers 3

8

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

df -hl
2

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

1
  • 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. Aug 23, 2013 at 7:20
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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