LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   df command output, doesn't add up? (https://www.linuxquestions.org/questions/linux-newbie-8/df-command-output-doesnt-add-up-463402/)

jrfk2 07-12-2006 02:43 PM

df command output, doesn't add up?
 
I do a df command on my mounted 256MB memory key and it reports in default 1K-blocks:

total: 245993
used: 3741
avail: 242253

well, if I add up avail and used, I get 1 more than the total.

Am I missing something here .. is it a matter of df rounding up counts of bytes ?

By the way, IS there a way to get it to report the numbers in bytes, I couldn't see to find an option for that in my version 4.5.8.

uselpa 07-12-2006 03:05 PM

To express it in bytes, use `df --block-size=1`.

jstephens84 07-12-2006 04:45 PM

might try df -h. that will put it in human readable form.

AwesomeMachine 07-12-2006 05:00 PM

You are supposed to get one extra because the drive starts at 0 and df starts at 1.

jrfk2 07-13-2006 07:09 AM

Thanks for all the responses so far, going to play with the --block-size=1.

But I am confused by the post that says the counts are supposed to be off by 1. I don't get it. No matter where the drive starts and where df starts, what df reports for used space and avail space should add up to total space.

jrfk2 07-13-2006 07:16 AM

it appears the counts being off is due to rounding off. When I run the df with --block-size=1, I get counts of:
total: 251896832
used: 3830272
avail: 248066560

and those add up ...

So I would *guess* the df code is rounding off when you get the data in bigger chunks .. maybe it needs to round up used and round down avail or something like that ...

thanks for all the help folks ...


All times are GMT -5. The time now is 02:34 PM.