Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different percentage as df #44

Open
martinszy opened this issue Sep 30, 2020 · 5 comments
Open

Different percentage as df #44

martinszy opened this issue Sep 30, 2020 · 5 comments

Comments

@martinszy
Copy link

So df says this:
/dev/mapper/ubuntu--vg-root 232G 210G 9.8G 96% /

And duf says this:
│ / │ 231.5G │ 209.9G │ 9.8G │ [##################..] 90.7% │ ext4 │ /dev/ubuntu--vg/root │

Why is this 90.7 vs 96 percentage difference?

This is on Ubuntu 20.04.1 with duf 3.1 and df 8.3.0

@muesli
Copy link
Owner

muesli commented Sep 30, 2020

The explanation is that the file systems reserves a certain amount of space and inodes for use by root (by default the amount of reserved space is 5%). Especially with bigger partitions this can be a significant amount of space that is not usable for services or users other than root.

df shows the same free/avail space, but then for some reason decides to exclude the reserved space from the percentage calculation. I always found that a bit weird, so I decided to ignore the reserved space in duf.

There's an argument to be had whether duf should deduct the reserved space when running as non-root. Opinions?

@martinszy
Copy link
Author

So my calculations are that 95.7% is the real percentage of occupied space in the disk, according to the numbers both software are reporting. Why whould duf say theres only 90%? If you're deducting a 5% from the percentage why wouldn't you also do it from the occupied space?

If there's this reserved number, I think it should be reported separately and then added to the sum of space that is not available.

Thanks my opinion at this point, but I just found out about this 5% reserved space, why is that?

@muesli
Copy link
Owner

muesli commented Sep 30, 2020

209.9G / 231.5G = 90.66% used. You can read more about ext's reasons here: https://unix.stackexchange.com/questions/7950/reserved-space-for-root-on-a-filesystem-why

@martinszy
Copy link
Author

I was calculating from the reported free space, that's where the difference comes from.

@muesli
Copy link
Owner

muesli commented Sep 30, 2020

Ah, I see! Yeah, there's definitely room for improvement here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants