RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1593451 - growpart fails when partition start sector is the same as partition size
Summary: growpart fails when partition start sector is the same as partition size
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-utils-growpart
Version: 7.5
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Lars Kellogg-Stedman
QA Contact: Yuxin Sun
URL:
Whiteboard:
Depends On:
Blocks: 1666854
TreeView+ depends on / blocked
 
Reported: 2018-06-20 21:13 UTC by John Pittman
Modified: 2020-04-09 09:53 UTC (History)
14 users (show)

Fixed In Version: 0.29-3
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1666854 (view as bug list)
Environment:
Last Closed: 2019-08-06 13:18:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patchfile (694 bytes, patch)
2018-06-20 21:13 UTC, John Pittman
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1807171 0 None None None 2018-12-06 14:40:44 UTC
Red Hat Product Errata RHBA-2019:2340 0 None None None 2019-08-06 13:18:51 UTC

Description John Pittman 2018-06-20 21:13:09 UTC
Created attachment 1453297 [details]
patchfile

Description of problem:

The growpart command will fail if the partition start sector is the same as partition size.

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

cloud-utils-growpart-0.29-2.el7

Steps to Reproduce:

- Make a partition that has same Start and Size:

[root@localhost ~]# parted /dev/sda u s p
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sda: 41943040s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start      End        Size       Type     File system  Flags
 1      2048s      1953791s   1951744s   primary  ext4         boot
 2      1953792s   19531250s  17577459s  primary               lvm
 3      19531251s  39062501s  19531251s  primary

- Attempt growpart:

[root@localhost ~]# growpart /dev/sda 3
failed [pt_update:1] pt_update /dev/sda 3
partx: /dev/sda: updating partition #3 failed: Invalid argument
partx: /dev/sda: error updating partition 3
partition: none, disk: /dev/sda, lower: 3, upper: 3
/dev/sda: partition table type 'dos' detected
/dev/sda: partition #3 resized
FAILED: pt_resize failed
***** WARNING: Resize failed, attempting to revert ******
Re-reading the partition table ...
BLKRRPART: Device or resource busy
sfdisk: The command to re-read the partition table failed.
Run partprobe(8), kpartx(8) or reboot your system now,
before using mkfs

***** Appears to have gone OK ****
             
Actual results:

growpart fails

Expected results:

growpart succeeds

Additional info:

Patch file attached

Comment 5 Lars Kellogg-Stedman 2018-12-06 14:40:24 UTC
We'll need to get the patch accepted upstream first. I've opened an upstream bug and I'll submit the patch against it.

Comment 6 Lars Kellogg-Stedman 2018-12-06 15:06:42 UTC
I've submitted a merge request upstream:

https://code.launchpad.net/~larsks/cloud-utils/cloud-utils/+merge/360197

That's a smaller patch than what was proposed here, but it seems to work in my tests.

Comment 7 Lars Kellogg-Stedman 2018-12-06 15:11:48 UTC
I have corrected the root cause description in https://access.redhat.com/solutions/3494521.

Comment 8 Lars Kellogg-Stedman 2018-12-10 03:56:20 UTC
I replaced the earlier merge request with https://code.launchpad.net/~larsks/cloud-utils/bug-1807171/+merge/360264, which has since merged upstream:

  https://bazaar.launchpad.net/~cloud-utils-dev/cloud-utils/trunk/revision/339

I'll backport this into our cloud-utils package.

Comment 10 John Pittman 2018-12-10 16:12:45 UTC
Lars, yes that fixed the issue.  Thanks.

[root@localhost ~]# rpm -ivh cloud-utils-growpart-0.29-3.el7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:cloud-utils-growpart-0.29-3.el7  ################################# [100%]

[root@localhost ~]# parted /dev/vda u s p
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 44040192s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start      End        Size       Type     File system  Flags
 1      2048s      2099199s   2097152s   primary  xfs          boot
 2      2099200s   20971519s  18872320s  primary               lvm
 3      20971520s  41943039s  20971520s  primary

[root@localhost ~]# growpart /dev/vda 3
CHANGED: partition=3 start=20971520 old: size=20971520 end=41943040 new: size=23068639,end=44040159

[root@localhost ~]# parted /dev/vda u s p
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 44040192s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start      End        Size       Type     File system  Flags
 1      2048s      2099199s   2097152s   primary  xfs          boot
 2      2099200s   20971519s  18872320s  primary               lvm
 3      20971520s  44040158s  23068639s  primary

Comment 11 Lars Kellogg-Stedman 2018-12-12 14:34:14 UTC
Note that since last week, upstream has moved to git, so the fix can now be found at:

  https://git.launchpad.net/cloud-utils/commit/?id=07c5a5a85e8ea2c1827a0c4948da3b6ca160414f

Comment 22 errata-xmlrpc 2019-08-06 13:18:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2340


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