Debian Bug report logs -
#666972
proc(5): /proc/partition block size and count method undocumented
Reported by: "A. Costa" <agcosta@gis.net>
Date: Tue, 3 Apr 2012 00:45:07 UTC
Severity: normal
Tags: moreinfo, upstream
Found in version manpages/3.35-0.1
Reply or subscribe to this bug.
Toggle useless messages
Report forwarded
to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#666972; Package manpages.
(Tue, 03 Apr 2012 00:45:10 GMT) (full text, mbox, link).
Acknowledgement sent
to "A. Costa" <agcosta@gis.net>:
New Bug report received and forwarded. Copy sent to Martin Schulze <joey@debian.org>.
(Tue, 03 Apr 2012 00:45:10 GMT) (full text, mbox, link).
Message #5 received at submit@bugs.debian.org (full text, mbox, reply):
Package: manpages
Version: 3.35-0.1
Severity: normal
Dear Maintainer,
% man proc | grep -A 2 -n '/proc/partition'
988: /proc/partitions
989- Contains major and minor numbers of each partition as well as number of
990- blocks and partition name.
There's no mention of how many bytes are in a block, and no description of how
block numbers are counted.
The counting method seems relevant since 'df' returns different numbers; numbers
which must have been counted using a different method:
% D=/proc/partitions
% cat $D | grep -w $D
8 37 58348048 sdc5
# show 'df /dev/sdc5' output, 1000 bytes per block
% df -B 1KB $D
Filesystem 1kB-blocks Used Available Use% Mounted on
/dev/sdc5 58765693 47037772 9337988 84% /tmp
# Again, with 1024 byte blocks:
% df -B 1K $D
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc5 57388372 45935324 9119128 84% /tmp
Summary:
1024b 57388372
1000b 58765693
proc 58348048
Neither 'df' block size matches 'proc'.
HTH...
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
manpages depends on no packages.
manpages recommends no packages.
Versions of packages manpages suggests:
ii coolman [man-browser] 3.17.7-3
ii konqueror [man-browser] 4:4.7.4-2
ii man-db [man-browser] 2.6.1-1
ii tkman [man-browser] 2.2-4
-- no debconf information
Information forwarded
to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#666972; Package manpages.
(Wed, 21 Aug 2013 21:51:04 GMT) (full text, mbox, link).
Acknowledgement sent
to Simon Paillard <spaillard@debian.org>:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>.
(Wed, 21 Aug 2013 21:51:04 GMT) (full text, mbox, link).
Message #10 received at 666972@bugs.debian.org (full text, mbox, reply):
Control: tag -1 +upstream
On Mon, Apr 02, 2012 at 08:43:17PM -0400, A. Costa wrote:
> Package: manpages
> Version: 3.35-0.1
> Severity: normal
>
> Dear Maintainer,
>
> % man proc | grep -A 2 -n '/proc/partition'
> 988: /proc/partitions
> 989- Contains major and minor numbers of each partition as well as number of
> 990- blocks and partition name.
>
> There's no mention of how many bytes are in a block, and no description of how
> block numbers are counted.
A full definition of fields is available in the kernel tree:
http://lxr.linux.no/#linux+v3.5/Documentation/iostats.txt
We can either just point to that doc in the manpage, or document all the fields
of /proc/partition.
--
Simon Paillard
Added tag(s) upstream.
Request was from Simon Paillard <spaillard@debian.org>
to 666972-submit@bugs.debian.org.
(Wed, 21 Aug 2013 21:51:04 GMT) (full text, mbox, link).
Information forwarded
to debian-bugs-dist@lists.debian.org, Martin Schulze <joey@debian.org>:
Bug#666972; Package manpages.
(Wed, 04 Sep 2013 14:33:08 GMT) (full text, mbox, link).
Acknowledgement sent
to mtk.manpages@gmail.com:
Extra info received and forwarded to list. Copy sent to Martin Schulze <joey@debian.org>.
(Wed, 04 Sep 2013 14:33:09 GMT) (full text, mbox, link).
Message #17 received at 666972@bugs.debian.org (full text, mbox, reply):
On Wed, Aug 21, 2013 at 11:49 PM, Simon Paillard <spaillard@debian.org> wrote:
> Control: tag -1 +upstream
>
> On Mon, Apr 02, 2012 at 08:43:17PM -0400, A. Costa wrote:
>> Package: manpages
>> Version: 3.35-0.1
>> Severity: normal
>>
>> Dear Maintainer,
>>
>> % man proc | grep -A 2 -n '/proc/partition'
>> 988: /proc/partitions
>> 989- Contains major and minor numbers of each partition as well as number of
>> 990- blocks and partition name.
>>
>> There's no mention of how many bytes are in a block, and no description of how
>> block numbers are counted.
>
> A full definition of fields is available in the kernel tree:
> http://lxr.linux.no/#linux+v3.5/Documentation/iostats.txt
>
> We can either just point to that doc in the manpage, or document all the fields
> of /proc/partition.
It would I think be best to have this information in the man page.
But, I cannot see where you are finding the info in
Documentation/iostats.txt, Simon.
A. Costa: From scanning the source code (where the count of blocks is
"part_nr_sects_read(part) >> 1" in block/genhd.c::show_partition() --
I assume a sector is 512 B), I'm reasonably sure that /proc/partitions
is giving us 1024-byte blocks. Here's my experiment:
$ cat /proc/partitions | grep sdc1
8 33 1465136128 sdc1
$ df -B 1024 | grep sdc1
/dev/sdc1 1464421040 447518960 1016902080 31% /run/media/mtk/CNM1500
$ bc -q
1465136128 * 1000000 / 1464421040
1000488
In other words, the difference between the two values is just under
0.05%. Looking at the source code of 'df', it gets it's information
using the statvfs() function which in turn calls statfs(2). I
confirmed that direct statfs(2) calls return information precisely
consistent with the output of df.
The question is still why there is a difference between blocks as
reported by statfs() and /proc/partitions, with the latter always a
little bigger than the former. Well, looking at the statfs()
implementation (fs/statfs.c), the relevant field pulled from kernel
data structures is 'f_blocks', and looking in (for example),
fs/ext4/super.c::ext4_statfs(),, I find:
buf->f_blocks = ext4_blocks_count(es) - EXT4_C2B(sbi, overhead);
"sbi" is super block info.
That looks to me to mean that stafs() is deducting a small amount from
the number of blocks, for the overhead of the super block info, and
without digging too much further, I'm going to guess that that might
explain the difference from /proc/partitions. However, that's all
fairly speculative, so I'm not confident enough to put too much detail
into the page. However, I did apply the small patch below:
Cheers,
Michael
diff --git a/man5/proc.5 b/man5/proc.5
index e40dd4d..95eb743 100644
--- a/man5/proc.5
+++ b/man5/proc.5
@@ -2160,7 +2160,7 @@ socket and Path is the bound path (if any) of the socket.
.TP
.I /proc/partitions
Contains major and minor numbers of each partition as well as number
-of blocks and partition name.
+of 1024-byte blocks and partition name.
.TP
.I /proc/pci
This is a listing of all PCI devices found during kernel initialization
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
Changed Bug title to 'manpages: proc(5): /proc/partition block size and count method undocumented' from 'manpages: 'man proc': /proc/partition block size and count method undocumented'
Request was from Simon Paillard <spaillard@debian.org>
to control@bugs.debian.org.
(Fri, 17 Jan 2014 21:03:42 GMT) (full text, mbox, link).
Changed Bug title to 'proc(5): /proc/partition block size and count method undocumented' from 'manpages: proc(5): /proc/partition block size and count method undocumented'
Request was from Stéphane Aulery <saulery@free.fr>
to control@bugs.debian.org.
(Sun, 08 Mar 2015 19:45:15 GMT) (full text, mbox, link).
Added tag(s) moreinfo.
Request was from Stéphane Aulery <saulery@free.fr>
to control@bugs.debian.org.
(Sun, 08 Mar 2015 19:45:45 GMT) (full text, mbox, link).
Send a report that this bug log contains spam.
Debian bug tracking system administrator <owner@bugs.debian.org>.
Last modified:
Thu Mar 9 09:59:07 2023;
Machine Name:
buxtehude
Debian Bug tracking system
Debbugs is free software and licensed under the terms of the GNU
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.
Copyright © 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson,
2005-2017 Don Armstrong, and many other contributors.