Dec/081
Answer: Why does df -k show wrong percentage usage?
I use the Nagios plugin from check_snmp_storage from manubulon.com to monitor disk usage on several unix and windows systems.
Some times I found some linux admins saying that their volumes are nearly full but Nagios did not notify them before. And in fact df -k said: “Disk is 95% full”. check_snmp_storage said: “Disk is 90% full”.
Well, I was searching some time to find the answer… After reading man pages, checking snmp values manually, reading code of check_snmp_storage I came to the point: The calculation of percentage usage in df -k is “wrong”.
Sample output of df -k:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 16973900 12379804 3738636 77% /myvol
here my percent calculation:
12379804/16973900*100=72.934352152%
So what? Another 5% diff… Everytime 5% on all disks I looked at.
Sure. All disks are ext3. After some research I found that the reason is the reserved space for root (by default 5%) in ext2 and ext3 volumes. For detailed information see explanation of -m param in man mke2fs:
-m reserved-blocks-percentage
Specify the percentage of the filesystem blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd(8), to continue to function correctly after non-privi‐leged processes are prevented from writing to the filesystem. The default percentage is 5%.
You can query volumes to see the amount of reserved space:
tune2fs -l /dev/sda1
After that I found the option -R for check_snmp_storage. With these option you can add the reserved-blocks-percentage to the results of that checks. -R 5 does the job.








17:25 on July 22nd, 2010
Thanks for this info, this is exactly the same problem I was having, and this is exactly the solution I was looking for.