GNU bug report logs - #10755
stat: Please add directive to display size on disk (%S)

Previous Next

Package: coreutils;

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

Date: Tue, 7 Feb 2012 20:13:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 10755 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#10755; Package coreutils. (Tue, 07 Feb 2012 20:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Filipus Klutiero <chealer <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 07 Feb 2012 20:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filipus Klutiero <chealer <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: stat: Please add directive to display size on disk
Date: Tue, 07 Feb 2012 15:10:51 -0500
The other day I tried figuring out how much disk space a small file 
took. I used stat, but I only realized today that stat does not provide 
that information directly, as explained by Eric Blake and Pádraig Brady 
in http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10561

This information is provided indirectly by %b and %B. Multiplying the 2 
should give the size on disk. Example:

stat -c 'allocated-space=%B*%b apparent-size=%s' $file

Currently, this information can be obtained from du:

$ stat -c '%s' /etc/phpmyadmin/htpasswd.setup
54
chealer <at> vinci:~$ du -h /etc/phpmyadmin/htpasswd.setup
4,0K    /etc/phpmyadmin/htpasswd.setup
chealer <at> vinci:~$

However, it would be quite useful if stat could be used to display 
simultaneously a file's real size and size on disk.


Eric Blake suggested this directive to be %S. For the description, he 
suggested:

%S  Allocated size (same as %b * %B)

I would like to aim for clarity, as these various statistics can be 
confusing. I suggest to use the name "Size on disk". I also suggested 
the following:

Size occupied when including slack space
Size of the clusters occupied

I suggest the following synthesis:

Allocated size (space allocated on the storage device, same as %b * %B). 
This is the size of the allocated clusters, which includes slack space.




Information forwarded to bug-coreutils <at> gnu.org:
bug#10755; Package coreutils. (Tue, 07 Feb 2012 20:56:01 GMT) Full text and rfc822 format available.

Message #8 received at 10755 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Filipus Klutiero <chealer <at> gmail.com>
Cc: 10755 <at> debbugs.gnu.org
Subject: Re: bug#10755: stat: Please add directive to display size on disk
Date: Tue, 07 Feb 2012 12:54:44 -0800
On 02/07/2012 12:10 PM, Filipus Klutiero wrote:
> Size on disk

We don't know it's a disk drive; it might be
any storage device that contain a file system.
Perhaps a better shorthand string would be "Allocation"?
That's even shorter, and it conveys what's going on.




Information forwarded to bug-coreutils <at> gnu.org:
bug#10755; Package coreutils. (Tue, 07 Feb 2012 22:37:01 GMT) Full text and rfc822 format available.

Message #11 received at 10755 <at> debbugs.gnu.org (full text, mbox):

From: Filipus Klutiero <chealer <at> gmail.com>
To: 10755 <at> debbugs.gnu.org
Subject: Re: bug#10755: stat: Please add directive to display size on disk
Date: Tue, 07 Feb 2012 17:35:27 -0500
On 2012-02-07 15:54, Paul Eggert wrote:
> On 02/07/2012 12:10 PM, Filipus Klutiero wrote:
>> Size on disk
> We don't know it's a disk drive; it might be
> any storage device that contain a file system.

I agree. I see an advantage in using the term "Size on disk": it is well 
known from Windows ( 
http://technet.microsoft.com/en-us/magazine/hh148159.aspx ). But indeed, 
it does not always apply. It could be mentioned in a parenthesis and/or 
in quotes nevertheless to facilitate search.
> Perhaps a better shorthand string would be "Allocation"?
> That's even shorter, and it conveys what's going on.

Oh, good question. We currently have:

> Size: 54              Blocks: 8          IO Block: 4096

If we want to display the allocated size too, "Size" for "real"(?) size 
becomes clearly ambiguous. How about having a line for size? Something like

> Size    Real: 54    Allocated: 4096






Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 16 Oct 2018 16:21:02 GMT) Full text and rfc822 format available.

Changed bug title to 'stat: Please add directive to display size on disk (%S)' from 'stat: Please add directive to display size on disk' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 16 Oct 2018 16:21:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 309 days ago.

Previous Next


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