Skip to contentSkip to conversation

ext4 df free space reporting not reliable?

DISCUSSION Andi Kleen 3 participants 5 messages Jun 13, 2010

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Hi,

I have a ext4 file system on 2.6.34 that shows 0 blocks available in "df" (it's nearly full but never got a ENOSPC).

But when I delete a couple of files it still shows 0 blocks. And I can actually create small files without problem, so clearly there is at least some space available.

So is df reporting not accurate?

Thanks,
-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#1 lore raw
Quoted 10 lines · Andi Kleen

Hi,

I have a ext4 file system on 2.6.34 that shows 0 blocks available in "df" (it's nearly full but never got a ENOSPC).

But when I delete a couple of files it still shows 0 blocks. And I can actually create small files without problem, so clearly there is at least some space available.

So is df reporting not accurate?

Are you creating the files as root? Sounds like the standard reserved blocks behavior that's been around since ext3, ext2, BSD's ufs, etc...

- Ted

author
#2 lore raw
Quoted 2 lines

Are you creating the files as root? Sounds like the standard reserved blocks behavior that's been around since ext3, ext2, BSD's ufs, etc...

Yes everything is root.

I would expect root df to not report the reservation. Is that not the case?

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#3 lore raw
Quoted 9 lines · Andi Kleen
Quoted 3 lines

Are you creating the files as root? Sounds like the standard reserved blocks behavior that's been around since ext3, ext2, BSD's ufs, etc...

Yes everything is root.

I would expect root df to not report the reservation. Is that not the case?

-Andi

Is the root reserve (default 5% on ext3, not sure for ext3) set to 0?

tune2fs -m0 /dev/sdX

The file-system does not need to be unmounted to do this but this will change the amount reported as available as once it hits 0 with the root reserve only root can write to the FS.

#4 lore raw
In reply to Andi Kleen
Quoted 6 lines · Andi Kleen
Quoted 2 lines

Are you creating the files as root? Sounds like the standard reserved blocks behavior that's been around since ext3, ext2, BSD's ufs, etc...

Yes everything is root.

I would expect root df to not report the reservation. Is that not the case?

No, the reservation is always reported, regardless of which user ID is executing the statfs(2) system call. This has always been true, going all the way back to BSD 4.3.

I could see the argument for doing this differently, but I could also see that being very surprising for people to see different results depending on whether they are running df from a setuid shell or not. I'm not aware of any Unix system which has implemented the root-only reservation system which has done this.

- Ted