Bug 1284535 - parted does not always optimally align partitions when possible [NEEDINFO]
parted does not always optimally align partitions when possible
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: parted (Show other bugs)
All Linux
unspecified Severity medium
: pre-dev-freeze
: 7.3
Assigned To: Brian Lane
Release Test Team
Depends On:
  Show dependency treegraph
Reported: 2015-11-23 09:33 EST by Matthew Whitehead
Modified: 2016-01-29 11:52 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-01-29 11:52:23 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
bcl: needinfo? (mwhitehe)

Attachments (Terms of Use)

  None (edit)
Description Matthew Whitehead 2015-11-23 09:33:01 EST
Description of problem: parted makes a very simple attempt to align partitions to a multiple of /sys/block/sda/queue/optimal_io_size. It often fails to align but does not report this.

Version-Release number of selected component (if applicable): parted-2.1-17

How reproducible: 100%

Steps to Reproduce:
1. On a system with a 2.5MiB (1310720 bytes) optimal_io_size create a partition with parted.
2. type 'units MiB'
3. type 'mkpart primary 1MiB 100%

Actual results: It will not align at 2.5MiB, nor print an error.

Expected results: It should align to optimal_io_size of 2.5MiB.

Additional info: There is a patch that prints out when parted fails to align: 


The root cause seems to be the rounding functions in libparted/cs/natmath.c, called in  _closest_inside_geometry().

If the units are not large enough (using 'KiB' or'MiB' instead of 'GiB' or 'cyl'), it doesn't have enough room for the ped_round_up_to() calls to align cleanly.

Using larger units does align, but wastes space.
Comment 2 Brian Lane 2015-11-23 12:45:27 EST
This doesn't match what I remember from our IRC conversations. I thought the 1MiB was working and the problem was 1024KiB didn't align correctly.

Please paste the text from a session using the patch that prints the alignment math, this is difficult to duplicate without this specific device.

The only behavior here that I would consider a bug is if it doesn't align AND doesn't tell you that it couldn't align. Also, 1310720 bytes isn't 2.5MiB.

Note You need to log in before you can comment on or make changes to this bug.