All of lore.kernel.org
 help / color / mirror / Atom feed
* df returns incorrect size of partition due to huge overhead block count in ext4 partition
@ 2022-03-25  6:42 Fariya F
  2022-03-25 22:11 ` Theodore Ts'o
  0 siblings, 1 reply; 9+ messages in thread
From: Fariya F @ 2022-03-25  6:42 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel

My eMMC partition is ext4 formatted and has about 100MB size. df -h
command lists the size of the partition and the used percentage as
below.
    Filesystem           Size  Used Avail Use% Mounted on

    /dev/mmcblk2p4    16Z   16Z   79M 100% /data

For your reference, the returned values for statfs64( ) are

statfs64("/data", 88, {f_type="EXT2_SUPER_MAGIC", f_bsize=1024,
f_blocks=18446744073659310077, f_bfree=87628, f_bavail=80460,
f_files=25688, f_ffree=25189, f_fsid={-1446355608, 1063639410},
f_namelen=255, f_frsize=1024, f_flags=4128}) = 0

The output dumpe2fs returns the following


    Block count:              102400

    Reserved block count:     5120

    Overhead blocks:          50343939

As per my kernel (4.9.31) code, the f_blocks is block_count - overhead
blocks. Considering the subtraction with the above values results in a
negative value this is interpreted as the huge value of
18446744073659310077.

I have a script which monitors the used percentage of the partition
using df -h command and when the used percentage is greater than 70%,
it deletes files until the used percentage comes down. Considering df
is reporting all the time 100% usage, all my files get deleted.

My questions are:

a) Where does overhead blocks get set?

b) Why is this value huge for my partition and how to correct it
considering fsck is also not correcting this

Please note fsck on this partition doesn't report any issues at all.

I am also able to create files in this partition.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-04-15 14:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-25  6:42 df returns incorrect size of partition due to huge overhead block count in ext4 partition Fariya F
2022-03-25 22:11 ` Theodore Ts'o
2022-03-28 16:08   ` Fariya F
2022-03-29 13:08     ` Theodore Ts'o
2022-04-12  8:56       ` Fariya F
2022-04-15  2:54         ` [PATCH 1/3] ext4: fix overhead calculation to account for the reserved gdt blocks Theodore Ts'o
2022-04-15  2:54           ` [PATCH 2/3] ext4: force overhead calculation if the s_overhead_cluster makes no sense Theodore Ts'o
2022-04-15  2:54           ` [PATCH 3/3] ext4: update the cached overhead value in the superblock Theodore Ts'o
2022-04-15 14:41         ` df returns incorrect size of partition due to huge overhead block count in ext4 partition Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.