Subject: bug#20909: closed (Re: bug#20909: incorrect partition size calculation)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 02 Jul 2015 18:04:03 +0000

Your bug report

#20909: incorrect partition size calculation

which was filed against the parted package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20909: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20909
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20909: incorrect partition size calculation
From: Phil Susi <[email-masked]>
To: [email-masked]
Date: Thu, 02 Jul 2015 14:02:14 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On 6/29/2015 2:37 PM, Gena Makhomed wrote:
>> You are off by 1. start and end are inclusive so the size of sda4 is:
>>
>> 1 + (7814037134 - 102764544) = 7711272591
>>

Closing for this reason.

> BTW, "start and end are inclusive" - IMHO is very bad decision,
> because now it is not possible to partition disk using MiB units
> and always need use sectors and make all calculations manually.

No.. MiB units work just fine.

> for example, parted -s /dev/sda mkpart primary 34s 1MiB
> now use one sector from second MiB and next partition
> will be created as unaligned.

No, it doesn't... the partition ends on sector 2047, so the next 
partition can start on sector 2048.

Subject: incorrect partition size calculation
From: Gena Makhomed <[email-masked]>
To: [email-masked]
Date: Sat, 27 Jun 2015 05:19:03 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, All!

incorrect partition size calculation

# parted -v
parted (GNU parted) 2.3

Model: ATA HGST HUS724040AL (scsi)
Disk /dev/sda: 7814037168s

how to reproduce:

parted -s /dev/sda mklabel gpt
parted -s /dev/sda -a none mkpart primary 34s 2047s
parted -s /dev/sda set 1 bios_grub on
parted -s /dev/sda mkpart primary 2048s 2099199s
parted -s /dev/sda set 2 raid on
parted -s /dev/sda mkpart primary 2099200s 102764543s
parted -s /dev/sda set 3 raid on
parted -s /dev/sda mkpart primary zfs 102764544s 7814037134s

parted
(parted) unit s
(parted) print free
Model: ATA HGST HUS724040AL (scsi)
Disk /dev/sda: 7814037168s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start       End          Size         File system  Name     Flags
  1      34s         2047s        2014s                     primary 
bios_grub
  2      2048s       2099199s     2097152s                  primary  raid
  3      2099200s    102764543s   100665344s                primary  raid
  4      102764544s  7814037134s  7711272591s               primary

(parted)

=======================================

parted reports what /dev/sda4 partition has size of 7711272591s
but this is not true, partition size is 7711272590s:

7814037168 - 2014 -  2097152 - 100665344 - 34 - 34 == 7711272590

P.S.

sorry, I can't find bugzilla for parted and can't check
what this bug for parted was previously reported and fixed.

-- 
Best regards,
  Gena