Numbers behind "df" and "tune2fs"

Eric Sandeen sandeen at
Wed Sep 18 15:25:48 UTC 2013

On 9/17/13 1:34 AM, Nicolas Michel wrote:
> In fact the thing I really want to achieve is to be able to find the
> values and the algorithm that enable me to reproduce the percentage
> given by df (and to understand deeply what it means).
> Why do I need it? Because I'm trying to write some script to do
> capacity planning and space problem forecast. Currently I don't really
> know which values I should use to do it. (I could use the percentage
> given by df but it lacks some precisions to make usefull forecasts)

If you want "the truth" just mount -o minixdf, tune2fs to 0 blocks reserved,
and you'll get the actual number of blocks contained in the filesystem,
the actual number of blocks used, and the actual blocks free.  Why extN
made it so complicated, I don't really know.

If you want to see how the sausage is made, look at ext3_statfs()
for all the hairy calculations.  (ext4_statfs() is even more complex).

Until recently, it was all complicated enough that even the kernel code got
it wrong.  ;)

0875a2b448fcaba67010850cf9649293a5ef653d ext4: include journal blocks in df overhead calcs
b72f78cb63fb595af63fc781dced0a6fd354e572 ext4: fix overhead calculations in ext4_stats, again
952fc18ef9ec707ebdc16c0786ec360295e5ff15 ext4: fix overhead calculation used by ext4_statfs()


More information about the Ext3-users mailing list