Bug 177457

Summary: diskinfo(8): diskinfo -v shows inacurate drive size
Product: Documentation Reporter: Ronald F. Guilmette <rfg>
Component: Manual PagesAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me CC: doc, rfg
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
smime.p7s none

Description Ronald F. Guilmette 2013-03-29 01:00:00 UTC
Apparently, under various conditions, diskinfo -v will show a size for
the specified drive which is smaller than the actual physical drive size,
as indicated by S.M.A.R.T. information (which can be queried using smartctl,
part of the smartmontools port).

This behavior on the part of diskinfo may perhaps be attributable to the
presence of either a Host Protected Area (HPA) and/or a Device Configuration
Overlay (DCO), or perhaps even by the interposition, between the physical
drive and the host, of certain brands and models of STAT/USB protocol
adapters/converters.

Although I personally am not sure of the specific conditions that may
give rise to these anomolies in the drive size, as reported by diskinfo,
I _am_ completely sure that the man page for diskinfo really should
include detailed information on the actual source of the drive size
information that it displays.  Unfortunately, at present it does not,
leaving the subject entirely open to speculation.

This should be corrected.  The diskinfo man page should be enhanced to
include information about the source of the drive size information and
the various factors that might possibly cause the drive size, as reported
by diskinfo, to differ from that reported by smartctl.

Fix: 

I really don't know what the proper fix is.  Either the author or the
source code of diskinfo should be consulted to try to find out the source
of the drive size information that diskinfo reports.
How-To-Repeat: 
man 8 diskinfo
Comment 1 Jason Unovitch freebsd_committer freebsd_triage 2013-06-24 17:42:39 UTC
Isn't this the classic case of the OS using a base of 1024 to calculate 
size and the hard drive manufacturer using 1000 for the same purpose?  
My "3TB" Western Digital Drives show 3.0 TB using smartctl -a and 2.7 TB 
using diskinfo -v.  I get the same 2.7 TB when I manually divide the 
media size in bytes by 1024 four separate times.

Respectfully,
Jason Unovitch
Comment 2 Ronald F. Guilmette 2013-06-24 22:05:07 UTC
In message <51C876FF.4030302@gmail.com>, you wrote:

>Isn't this the classic case of the OS using a base of 1024 to calculate
>size and the hard drive manufacturer using 1000 for the same purpose?

I do not believe so, no.

It has been awhile since I filed this PR, but I believe that the
non-matching numbers I was looking at were sector counts... NOT
byte counts.

The number of sectors on a drive is the number of sectors on that drive.
It should not be different between different tools one might use to
look at that number.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:01 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped