GNU bug report logs - #22496
why does the parted math look wrong - Q1 ?

Previous Next

Package: parted;

Reported by: Chris Johnson <cj <at> tothemax.us>

Date: Sat, 30 Jan 2016 22:48:02 UTC

Severity: normal

To reply to this bug, email your comments to 22496 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#22496; Package parted. (Sat, 30 Jan 2016 22:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Johnson <cj <at> tothemax.us>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Sat, 30 Jan 2016 22:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Johnson <cj <at> tothemax.us>
To: bug-parted <at> gnu.org
Subject: why does the parted math look wrong - Q1 ?
Date: Sat, 30 Jan 2016 15:48:44 -0500
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-parted <at> gnu.org:
bug#22496; Package parted. (Sun, 31 Jan 2016 18:40:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Narcis Garcia <debianbugs <at> actiu.net>
To: bug-parted <at> gnu.org
Subject: Re: bug#22496: why does the parted math look wrong - Q1 ?
Date: Sun, 31 Jan 2016 18:16:48 +0100
I see inconsistent data when printing table. It shoud be:
 Number  Start       End         Size       File system  Name  Flags
 1      0cyl        121600cyl** 121601cyl*               zfs
 9      121600cyl** 121601cyl   2cyl*

* Starting cylinder should be the first cylinder and count in the amount
** Strange ending at same cylinder that other partition begins.

The problem may be partitions aren't created in cylinders (but sectors),
and you try to calculate numbers based on a worng unit now.


On 30/01/16 21:48, Chris Johnson wrote:
> 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.




Information forwarded to bug-parted <at> gnu.org:
bug#22496; Package parted. (Mon, 01 Feb 2016 17:05:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: bug-parted <at> gnu.org
Cc: cj <at> tothemax.us
Subject: Re: bug#22496: why does the parted math look wrong - Q1 ?
Date: Mon, 1 Feb 2016 09:04:20 -0800
On Sat, Jan 30, 2016 at 03:48:44PM -0500, Chris Johnson wrote:
> Hi,
> 
> I need some education on how parted is doing math.  ;-)

It would probably be better to have this discussion on the devel list,
not the bug tracker:

parted-devel <at> lists.alioth.debian.org

AFAIK nobody uses cylinders for anything these days. I certainly haven't
used them for over a decade. Why aren't you using sectors?

As far as understanding the math, you're probably going to have to look
at the code :)

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)




This bug report was last modified 9 years and 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.