df cmd calculates wrong percent usage (FC6)
Jacques Beigbeder
Jacques.Beigbeder at ens.fr
Sat Jan 13 11:31:19 UTC 2007
Hello,
That's a feature.
>> /dev/hdb1 10078820 4932492 4634344 52% /
>> ...
>> In the first filesystem line e.g., there is a usage of 4932492 blocks
>> against 10078820 number of blocks in the filesystem, this are rounded
>> 49% and not 52%. It seems that the "use%" is taken from another data
>> source than from "Used/1K-blocks".
I take an empty filesystem, I fill it with zeros:
# df -k /a
/dev/sda10 14017840 165992 13139772 2% /a
# dd if=/dev/zero of=/a/MMM bs=10485760 &
# df -k /a
/dev/sda10 14017840 13312940 0 100% /a
...
# df -k /a
/dev/sda10 14017840 13424820 0 100% /a
...
# df -k /a
/dev/sda10 14017840 14015096 0 100% /a
Strange, you get 100% when Used is 13312940, or 13424820, or 14015096.
Explanation: man mke2fs, option -m:
-m reserved-blocks-percentage
Specify the percentage of the filesystem blocks reserved for the
super-user. This avoids fragmentation, and allows root-owned dae-
mons, such as syslogd(8), to continue to function correctly after
non-privileged processes are prevented from writing to the filesys-
tem. The default percentage is 5%.
So 5% is reserved to accelerate I/O. And a filesystem is full when it gets 105%.
But only root can bypass 100%.
For other Unix, default 5% can be 10% (FreeBSD), or vary from 1 to 10%
(depending on the filesystem size) in Solaris.
tune2fs(8) can change this value.
--
Jacques Beigbeder | Jacques.Beigbeder at ens.fr
Service de Prestations Informatiques | http://www.spi.ens.fr
Ecole normale supérieure |
45 rue d'Ulm |Tel : (+33 1)1 44 32 37 96
F75230 Paris cedex 05 |Fax : (+33 1)1 44 32 20 75
More information about the users
mailing list