Subject: df command doesnt report correct output

From: Fariya F <[email-masked]>
Date: Wed, 16 Mar 2022 21:38:16 +0530

Hi,

My eMMC device has a partition which reports the below output from df -h
command:

Filesystem       Size  Used Avail Use% Mounted on
/dev/mmcblk2p3    16Z   16Z   84M 100% /data

the partition is of size 100MB though! The partition is ext4 formatted. As
can be seen above, the output reports huge values for Used space. in
reality, the partition is just about 5MB used but for some reason df
reports the huge value. When i check the partition used size via du -sh
command, it reports the below:

#du -sh
5.8MB

I also checked the ouput via tune2fs command and below is what I get:

Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              25688
Block count:              102400
Reserved block count:     5120
Overhead blocks:        50343939
Free blocks:              87634
Free inodes:              25190
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Fragments per group:      8192
Inodes per group:         1976
Inode blocks per group:   247
Flex block group size:    16
Filesystem created:       Thu Nov 21 06:38:03 2019
Last mount time:          Thu Mar 10 13:20:58 2022
Last write time:          Thu Mar 10 13:20:58 2022
Mount count:              31
Maximum mount count:      -1
Last checked:             Sat Jan 22 08:17:33 2022
Check interval:           0 (<none>)
Lifetime writes:          604 MB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               128
Journal inode:            8

Any idea what is the Overhead blocks and why the Overhead blocks is showing
a huge number? Though the output from df command indicates 100% usage, I am
still able to create files in the partition. Any idea how to ensure df
command returns the correct value instead of 100% usage or how to clear the
"overhead blocks" listed in tune2fs?

My script goes through the usage percentage of a partition and deletes off
files if usage is >70%. Because df command  always shows 100% usage it
always deletes any files. Please let me know if df command is apt to use Or
some other command like du i should use.

Regards

Ff