title: WMI: Win32_DiskDrive to get total sector on the physical disk drive
body: <p>I have tried getting the maximum total sector of a disk using <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394132%28v=vs.85%29.aspx" rel="nofollow noreferrer">Win32_DiskDrive</a> but all of them return the incorrect value. I used <a href="http://mh-nexus.de/en/hxd/" rel="nofollow noreferrer">HxD</a> and this program return the accurate value. I've tried to get the total sector in Linux using fdisk, it also return accurately.</p>
  
  <p>I notice that there's a Note in the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa394132%28v=vs.85%29.aspx" rel="nofollow noreferrer">Win32_DiskDrive MSDN </a>as follow:</p>
  
  <blockquote>
    <p>the value for this property is obtained through extended functions of BIOS interrupt 13h. The value may be inaccurate if the drive uses a translation scheme to support high-capacity disk sizes. Consult the manufacturer for accurate drive specifications.</p>
  </blockquote>
  
  <p>But I couldn't understand what it means? and how to resolve this issue? </p>
  
  <h2>Update 1:</h2>
  
  <p>Here's a snip code of my python script.</p>
  
  <p>Required: <a href="http://python.org/download/" rel="nofollow noreferrer">Python</a>, <a href="http://sourceforge.net/projects/pywin32/files/pywin32/" rel="nofollow noreferrer">PyWin32</a>, <a href="http://pypi.python.org/pypi/WMI/#downloads" rel="nofollow noreferrer">WMI</a></p>
  
  <pre><code>import wmi
  
  c = wmi.WMI()
  for diskDrive in c.query("SELECT * FROM Win32_DiskDrive"):
      print diskDrive.Name, "\nTotal Sector: ", diskDrive.TotalSectors
  </code></pre>
  
  <h2>Update 2:</h2>
  
  <p>As requested, here's the Snippet of WMI with HxD total sector detected.</p>
  
  <ul>
  <li><strong>WMI:</strong> 625137345 (Top)</li>
  <li><strong>HxD:</strong> 625142448 (Bottom)</li>
  </ul>
  
  <p><img src="https://i.stack.imgur.com/7eFTY.png" alt="Sector Difference Screenshot"></p>
  
  <h2>Update 3:</h2>
  
  <p>If anyone interested, you can also try this on your own computer and see whether the Win32_DiskDrive report the accurate result. I tried this on many other computer <em>(WinXP &amp; 7)</em> with other storage device <em>(Hard disk, Flash Disk, etc.)</em>, but the all of the result is inaccurate. </p>
  
  <p>To try please install <a href="http://python.org/download/" rel="nofollow noreferrer">Python</a>, <a href="http://sourceforge.net/projects/pywin32/files/pywin32/" rel="nofollow noreferrer">PyWin32</a>, <a href="http://pypi.python.org/pypi/WMI/#downloads" rel="nofollow noreferrer">WMI</a></p>
  
  <p><strong>Thank you very much</strong></p>