GNU bug report logs - #21136
incorrect partition size calculation

Previous Next

Package: parted;

Reported by: Gena Makhomed <gmm <at> csdoc.com>

Date: Sun, 26 Jul 2015 17:02:01 UTC

Severity: normal

Done: "Brian C. Lane" <bcl <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Gena Makhomed <gmm <at> csdoc.com>
Subject: bug#21136: closed (Re: bug#21136: Fwd: Inconsistent behavior
 creating partitions with 'Xmib' and 'X%' (off-by-1 error?))
Date: Thu, 26 Aug 2021 21:34:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#21136: 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 21136 <at> debbugs.gnu.org.

-- 
21136: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21136
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: "Brian C. Lane" <bcl <at> redhat.com>
To: 21136-close <at> debbugs.gnu.org
Subject: Re: bug#21136: Fwd: Inconsistent behavior creating partitions with
 'Xmib' and 'X%' (off-by-1 error?)
Date: Thu, 26 Aug 2021 14:33:20 -0700
-- 
Brian C. Lane (PST8PDT) - weldr.io - lorax - parted - pykickstart


[Message part 3 (message/rfc822, inline)]
From: Gena Makhomed <gmm <at> csdoc.com>
To: bug-parted <at> gnu.org
Subject: incorrect partition size calculation
Date: Sun, 26 Jul 2015 20:01:39 +0300
On 02.07.2015 21:02, Phil Susi wrote:

>> 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.

I am just tested again on parted version 3.1
- it uses one more sector in case of "mib" unit.

>> 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.

steps to reproduce bug:

Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start  End        Size       File system  Name     Flags
 1      34s    2047s      2014s                   primary  bios_grub
        2048s  67108822s  67106775s  Free Space

if I issue command "mkpart primary 1MiB 8193MiB" - all works fine:

Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start      End        Size       File system  Name     Flags
 1      34s        2047s      2014s                   primary  bios_grub
 2      2048s      16779263s  16777216s               primary
        16779264s  67108822s  50329559s  Free Space

but if I issue command "mkpart primary 1mib 8193mib" - BUG IS HERE:

Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:

Number  Start      End        Size       File system  Name     Flags
 1      34s        2047s      2014s                   primary  bios_grub
 2      2048s      16779264s  16777217s               primary
        16779265s  67108822s  50329558s  Free Space

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

difference only in unit name case: 'MiB' works fine,
'mib' create wrong partitions, used one more sector.

looks like this is bug, and behavior of parted
should be the same, regardless of unit name case: 'mib' or 'MiB'.

-- 
Best regards,
 Gena



This bug report was last modified 3 years and 272 days ago.

Previous Next


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