GNU bug report logs - #10561
stat unclear about size on disk and type of blocks discussed

Previous Next

Package: coreutils;

Reported by: Filipus Klutiero <chealer <at> gmail.com>

Date: Fri, 20 Jan 2012 07:18:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#10561: closed (stat unclear about size on disk and type of
 blocks discussed)
Date: Fri, 20 Jan 2012 14:18:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 20 Jan 2012 14:15:41 +0000
with message-id <4F19770D.8000006 <at> draigBrady.com>
and subject line Re: bug#10561: stat unclear about size on disk and type of blocks discussed
has caused the debbugs.gnu.org bug report #10561,
regarding stat unclear about size on disk and type of blocks discussed
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
10561: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10561
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Filipus Klutiero <chealer <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: stat unclear about size on disk and type of blocks discussed
Date: Fri, 20 Jan 2012 02:16:04 -0500
Today I tried figuring out how much disk space a small file took. I used 
stat, but that turned out surprisingly difficult:

> # LANG=C stat htpasswd.setup
>   File: `htpasswd.setup'
>   Size: 54              Blocks: 8          IO Block: 4096   regular file
> Device: 805h/2053d      Inode: 5268976     Links: 1
> Access: (0640/-rw-r-----)  Uid: (    0/    root)   Gid: (   33/www-data)
> Access: 2012-01-19 15:00:58.000000000 -0500
> Modify: 2012-01-19 15:00:54.000000000 -0500
> Change: 2012-01-19 15:00:54.000000000 -0500
>  Birth: -
> root <at> vinci:/etc/phpmyadmin#

The "real" size is clear, but at first I thought that didn't say the 
size on disk.

There are 3 interesting format sequences:

> %b
>  Number of blocks allocated (see %B)
> %B
>  The size in bytes of each block reported by %b

> %o
>  I/O block size

In the default format, %b is shown as "Blocks" and %o is shown as "IO 
Block".
On my system, there are 2 kinds of blocks, those on the HDD, 512 bytes 
each, and those of the filesystem, 4096 each. The manual's descriptions 
do not make it clear which kind of block is referred to. After 
verification, %b refers to HDD blocks.
I'm not sure what language should be used instead. Perhaps instead of 
blocks the manual should talk about "data storage device blocks".

As for %o, if you'd ask me what "I/O block size" means without any 
context, I'm far from being sure I would answer it means size on disk. I 
suggest to call this Size on disk, or Size used on the filesystem.



[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Jim Meyering <jim <at> meyering.net>
Cc: 10561-done <at> debbugs.gnu.org, Filipus Klutiero <chealer <at> gmail.com>
Subject: Re: bug#10561: stat unclear about size on disk and type of blocks
	discussed
Date: Fri, 20 Jan 2012 14:15:41 +0000
On 01/20/2012 02:03 PM, Jim Meyering wrote:
> Pádraig Brady wrote:
> ...
>>> As for %o, if you'd ask me what "I/O block size" means without any
>>> context, I'm far from being sure I would answer it means size on
>>> disk. I suggest to call this Size on disk, or Size used on the
>>> filesystem.
>>
>> I/O implies transfer.
>> So it corresponds to an "optimal transfer size hint"
>> This value can be different at each layer, for example:
>>
>> $ stat -c "%o" .                # file level
>> $ stat -f -c "%s" .             # file system level
>> # blockdev --getioopt /dev/sda  # device level
>>
>>> I'm not sure what language should be used instead. Perhaps instead
>>> of blocks the manual should talk about "data storage device blocks".
>>
>> I suppose we could clarify "I/O block size" a bit.
>> How about s|I/O block size|optimal I/O block transfer size|
> 
> or even without "block",
> 
>   "optimal I/O transfer size"

OK I'll go with "optimal I/O transfer size hint",
since there is nothing guaranteed about it,
and in fact it's often wrong.

cheers,
Pádraig.

p.s. marking bug done...


This bug report was last modified 13 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.