[Top][All Lists]

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

bug#10755: stat: Please add directive to display size on disk

From: Filipus Klutiero
Subject: bug#10755: stat: Please add directive to display size on disk
Date: Tue, 07 Feb 2012 15:10:51 -0500
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:8.0) Gecko/20120104 Icedove/8.0

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
address@hidden:~$ du -h /etc/phpmyadmin/htpasswd.setup
4,0K    /etc/phpmyadmin/htpasswd.setup

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.

reply via email to

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