coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: df: the inode format and various block-size arguments


From: Pádraig Brady
Subject: Re: df: the inode format and various block-size arguments
Date: Mon, 17 Sep 2012 09:42:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 09/17/2012 07:39 AM, Bernhard Voelker wrote:
Working on the new --output option for df, I realized that
'df -i' only honors the --block-size arguments 'si' and
'human-readable', but not arbitrary values like '1M':

   $ for o in human-readable si M 1M ; do \
       src/df -i --block-size=$o . ; \
     done
   Filesystem     Inodes IUsed IFree IUse% Mounted on
   /dev/sdb         256K   21K  236K    9% /home
   Filesystem     Inodes IUsed IFree IUse% Mounted on
   /dev/sdb         263k   22k  241k    9% /home
   Filesystem     Inodes IUsed  IFree IUse% Mounted on
   /dev/sdb       262144 21406 240738    9% /home
   Filesystem     Inodes IUsed  IFree IUse% Mounted on
   /dev/sdb       262144 21406 240738    9% /home

There's nothing helpful about this in the .texi file.
Is this correct behavior? If true, then it should at
least be documented.

Not a big issue, but yes inode count should be consistent
with formatting options for bytes so this is a bug I'd say.

But here's an even stranger example: df appends the
'B' suffix to the inode values while not taking the
factor into account:

src/df -i --block-size=MiB .
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
/dev/sdb       262144B 21406B 240738B    9% /home

What about this?

Yep it's not a byte count so there should be no 'B'.
There is a related general issue with human() in
that it treats the B suffix as significant:

# Why no suffix here?
$ df --block-size=1M .
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sdb1                98430     71074     22357  77% /home

# Without a leading '1' a suffix is used
$ df --block-size=M .
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sdb1               98430M    71074M    22357M  77% /home

# You can't use IEC units without a trailing 'B'
$ df --block-size=Mi .
df: invalid suffix in --block-size argument `Mi'

# But you can use IEC units without a trailing 'B' from the environment?
$ BLOCKSIZE=Mi df .
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sdb1                98430     71074     22357  77% /home

# IEC with a trailing 'B' is Ok as as --block-size arg
$ df --block-size=MiB .
Filesystem         1MiB-blocks      Used Available Use% Mounted on
/dev/sdb1             98430MiB  71074MiB  22357MiB  77% /home

# The only way to select SI units is to use a trailing 'B'
$ df --block-size=MB .
Filesystem          1MB-blocks      Used Available Use% Mounted on
/dev/sdb1             103211MB   74526MB   23443MB  77% /home

All very inconsistent and confusing.

Note fixing some of this is not possible because of backwards compat issues.

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]