Subject: bug#22497: parted math - Q2 and Q3 ?

From: Chris Johnson <[email-masked]>
Date: Sat, 30 Jan 2016 17:03:49 -0500

# 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 2)*

Based on the parted information shown above, I would assume that the 
Total Sectors could be calculated thus:

                     121601 * 255 * 63 = 1953520065
Indeed, *g*parted  shows this value when you look at the disk device 
information.

Alas, when I switch to units of sectors I get a different value!!!

(parted) unit s
unit s
(parted) p
p
Model: Generic Ide (ide)
Disk /dev/rdsk/c7t1d0p0: 1953525168s <---------
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start        End          Size         File system  Name  Flags
  1      256s         1953508750s  1953508495s               zfs
  9      1953508751s  1953525134s  16384s

*Question 3)*

When I look at the information above where units are sectors, it is 
clear that the "End" sector number is the last sector being used in the 
partition.  This is supported in the above example by the fact that 
partition 9's first sector number is one higher than the End sector 
number of partition 1.

Alas, when looking at the information in units of cylinders, it seems 
like there is a change in meaning.

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

If there are 121600 cylinders in partition 1  and the first of those is 
cylinder number 0, I would expect the ENDing cylinder number to be 121599.
This expectation would also seem reasonable given that the starting 
cylinder number for partition 9 is 121600.

Hmmm, perhaps what I am looking at is how parted displays information 
when partitions are not sized to end on a cylinder boundary?

It likely is the case that partition 1 does not nicely end with the last 
sector of cylinder 121599 but instead has some sectors in cylinder 
121600 and furthermore that partition 9's starting sector is also in 
cylinder 121600 ...
Is that what's going on here?

Given that this drive is SSD and the whole cylinder,head,sector thing is 
all a mirage, I assume there is no value to trying to align the 
partitions to cylinder boundaries.

Thanks for your insight.