Subject: bug#22496: why does the parted math look wrong - Q1 ?

From: Chris Johnson <[email-masked]>
Date: Sat, 30 Jan 2016 15:48:44 -0500

Hi,

I need some education on how parted is doing math.  ;-)

The drive is 1 TB.

# parted /dev/rdsk/c7t1d0p0
GNU Parted 2.3.0
Using /dev/rdsk/c7t1d0p0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit cyl
unit cyl
(parted) p
p
Model: Generic Ide (ide)
Disk /dev/rdsk/c7t1d0p0: 121601cyl
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 121601,255,63.  Each cylinder is 8225kB.
Partition Table: gpt

Number  Start      End        Size       File system  Name  Flags
  1      0cyl       121600cyl  121600cyl               zfs
  9      121600cyl  121601cyl  1cyl

*
Question 1)*

Based on the parted value  8225KB per cylinder,  I would think that 
sectors per cylinder could be calculated thus

     8225 KB/cyl   * 1024 Bytes/KB  = 8422400 Bytes/cyl

and  8422400 Bytes/cyl   / 512 Bytes/sector  = 16450   sectors per cylinder

However, I would also think that sectors per cylinder could be 
calculated thus:
                               
                                                                                               255  * 63  = 16065   sectors per cylinder

Obviously these numbers do not match.

Just for the heck of it, in case when parted says 1 KB it means 1,000 
bytes not 1,024 bytes, I did this math.

     8225 * 1000 = 8225000    / 512 = 16064.4531 sectors per cylinder

which is certainly closer to the value you get from 255 * 63 but it 
really doesn't make any sense to me to be thinking that we are getting a 
fractional number of sectors in a given cylinder.

Thanks for your insight.