Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1212323

Summary: parted creates extended/logical partitions that are rejected by the kernel
Product: Red Hat Enterprise Linux 7 Reporter: Marius Vollmer <mvollmer>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: jstodola, mkovarik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: parted-3.1-21.el7 Doc Type: Bug Fix
Doc Text:
Cause: parted previously generated an error about notifying the kernel if a logical partition started 1 sector past the start of the extended partition. Consequence: Fix: parted allows the logical partition to start 1 sector past the extended partition. Result: logical partitions can now start 1 sector after the extended partition and no errors are generated.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 11:34:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch none

Description Marius Vollmer 2015-04-16 07:36:26 UTC
Description of problem:

Parted allows the user the create partitions that are then rejected by the kernel, and parted gives a non-helpful error message.

This looks similar to bug 1172668 but I can reliably reproduce it.
 
Version-Release number of selected component (if applicable):

# rpmquery parted
parted-3.1-20.el7.x86_64
# uname -r
3.10.0-229.1.2.el7.x86_64

How reproducible:

Always

Steps to Reproduce:
# dd if=/dev/zero of=/disk1.img bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.0329325 s, 1.6 GB/s
# losetup --show -f /disk1.img 
/dev/loop0
# parted -s /dev/loop0 mktable msdos
# parted -s /dev/loop0 mkpart extended 1 50
# parted -s /dev/loop0 mkpart logical 1 24
Warning: The resulting partition is not properly aligned for best performance.
Error: Error informing the kernel about modifications to partition /dev/loop0p5 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/loop0p5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Error: Failed to add partition 5 (Device or resource busy)
# partprobe /dev/loop0
Error: Error informing the kernel about modifications to partition /dev/loop0p5 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/loop0p5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Error: Failed to add partition 5 (Device or resource busy)
# losetup -D
# losetup --show -f /disk1.img
/dev/loop0
# partprobe /dev/loop0
Error: Error informing the kernel about modifications to partition /dev/loop0p5 -- Device or resource busy.  This means Linux won't know about any changes you made to /dev/loop0p5 until you reboot -- so you shouldn't mount it or use it in any way before rebooting.
Error: Failed to add partition 5 (Device or resource busy)

Actual results:

The errors show above happen and there is no /dev/loop0p5.  However, there is /dev/loop0p1, which is unexpected.

Expected results:

The partition should either be created and be useable, or parted should refuse to create it with a helpful message.

Additional info:

The same sequence works on Fedora 22 with parted-3.2-5.fc22.x86_64 and linux 4.0.0-0.rc5.git4.1.fc22.x86_64.

Comment 1 Marius Vollmer 2015-04-16 07:41:53 UTC
Forgot to add:

Changing the sequence to this makes it work:

# parted -s /dev/loop0 mktable msdos
# parted -s /dev/loop0 mkpart extended 1 50
# parted -s /dev/loop0 mkpart logical 2 24
# lsblk
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0            11:0    1 1024M  0 rom  
vda           252:0    0    9G  0 disk 
├─vda1        252:1    0  500M  0 part /boot
└─vda2        252:2    0  8.5G  0 part 
  ├─rhel-swap 253:0    0  924M  0 lvm  [SWAP]
  └─rhel-root 253:1    0  7.6G  0 lvm  /
loop0           7:0    0   50M  0 loop 
├─loop0p1     259:1    0    1K  0 loop 
└─loop0p5     259:2    0   21M  0 loop 

Note that the logical partition now starts at 2, not 1.

The EBUSY reported by the kernel might mean that there was an attempt to register overlapping partitions, not that some other process has the block device open.

Comment 3 Brian Lane 2015-04-16 19:05:35 UTC
commit f503870153eda from upstream needs to be backported.

Comment 4 Brian Lane 2015-04-16 19:06:13 UTC
Created attachment 1015370 [details]
patch

Comment 5 Marius Vollmer 2015-04-17 07:20:30 UTC
(In reply to bcl from comment #3)
> commit f503870153eda from upstream needs to be backported.

If this is fixed in 7.2 only, I'll be perfectly happy.

Comment 7 Jan Stodola 2015-08-28 08:40:11 UTC
The logical partition is usable now:

[root@localhost ~]# dd if=/dev/zero of=/disk1.img bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.0384391 s, 1.4 GB/s
[root@localhost ~]# losetup --show -f /disk1.img
/dev/loop0
[root@localhost ~]# parted -s /dev/loop0 mktable msdos
[root@localhost ~]# parted -s /dev/loop0 mkpart extended 1 50
[root@localhost ~]# parted -s /dev/loop0 mkpart logical 1 24
Warning: The resulting partition is not properly aligned for best performance.
[root@localhost ~]# mkfs.xfs /dev/loop0p5 
meta-data=/dev/loop0p5           isize=256    agcount=1, agsize=5603 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=5603, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=853, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost ~]# lsblk 
NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda           252:0    0    9G  0 disk 
├─vda1        252:1    0  500M  0 part /boot
└─vda2        252:2    0  8.5G  0 part 
  ├─rhel-root 253:0    0  7.6G  0 lvm  /
  └─rhel-swap 253:1    0  924M  0 lvm  [SWAP]
loop0           7:0    0   50M  0 loop 
├─loop0p1     259:1    0  512B  0 loop 
└─loop0p5     259:2    0 21.9M  0 loop 
[root@localhost ~]# parted /dev/loop0 print
Model: Loopback device (loopback)
Disk /dev/loop0: 52.4MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  50.3MB  49.3MB  extended               lba
 5      1049kB  24.0MB  23.0MB  logical   xfs

[root@localhost ~]# rpm -q parted
parted-3.1-22.el7.x86_64
[root@localhost ~]#

Moving to VERIFIED.

Comment 8 errata-xmlrpc 2015-11-19 11:34:33 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://rhn.redhat.com/errata/RHBA-2015-2309.html