[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22496: why does the parted math look wrong - Q1 ?
From: |
Narcis Garcia |
Subject: |
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.