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.
Cause:
parted was not removing the last partition on device-mapper devices such as mpath.
Consequence:
There were stale device-mapper devices in /dev/mapper
Fix:
Reread the partition table when there were no partitions on device-mapper devices.
Result:
Device-mapper devices are removed as expected.
Description of problem:
parted is failing on multipath devices due to partitions entries in /dev/mapper being left behind after a parted rm command.
[root@marathon-02 mapper]# pwd
/dev/mapper
---- Initial creation ---
[root@marathon-02 mapper]# parted /dev/mapper/mpatha mkpart primary ext2 1 100
Information: You may need to update /etc/fstab.
[root@marathon-02 mapper]# ls
control mpathb mpathd mpathf mpathg1 rhel_marathon--02-home
mpatha mpathc mpathe mpathf1 mpathh rhel_marathon--02-root
mpatha1 mpathc1 mpathe1 mpathg mpathh1 rhel_marathon--02-swap
[root@marathon-02 mapper]# parted mpatha rm 1
Information: You may need to update /etc/fstab.
---- Creating again -- fails. Note, mpatha1 still exists after the above remove command.
[root@marathon-02 mapper]# parted /dev/mapper/mpatha mkpart primary ext2 1 100
device-mapper: create ioctl on mpatha1 failed: Device or resource busy
[root@marathon-02 mapper]# ls
control mpathb mpathd mpathf mpathg1 rhel_marathon--02-home
mpatha mpathc mpathe mpathf1 mpathh rhel_marathon--02-root
mpatha1 mpathc1 mpathe1 mpathg mpathh1 rhel_marathon--02-swap
---- Try to remove the partition again, note mpatha1 is still in /dev/mapper after the command
# parted mpatha rm 1
Information: You may need to update /etc/fstab.
[root@marathon-02 mapper]# ls
control mpathb mpathd mpathf mpathg1 rhel_marathon--02-home
mpatha mpathc mpathe mpathf1 mpathh rhel_marathon--02-root
mpatha1 mpathc1 mpathe1 mpathg mpathh1 rhel_marathon--02-swap
--- Reload mpath
[root@marathon-02 mapper]# multipath -F
[root@marathon-02 mapper]# multipath -r
<SNIP>
--- mpatha1 is now gone
[root@marathon-02 mapper]# ls
control mpathc1 mpathf mpathh rhel_marathon--02-swap
mpatha mpathd mpathf1 mpathh1
mpathb mpathe mpathg rhel_marathon--02-home
mpathc mpathe1 mpathg1 rhel_marathon--02-root
--- Make the partition again, success
[root@marathon-02 mapper]# parted /dev/mapper/mpatha mkpart primary ext2 1 100
Information: You may need to update /etc/fstab.
[root@marathon-02 mapper]# ls
control mpathb mpathd mpathf mpathg1 rhel_marathon--02-home
mpatha mpathc mpathe mpathf1 mpathh rhel_marathon--02-root
mpatha1 mpathc1 mpathe1 mpathg mpathh1 rhel_marathon--02-swap
It seems the failure is due to mpatha1 not being removed after the parted rm command.
Version-Release number of selected component (if applicable):
parted-3.1-17.el7.x86_64
kernel 3.10.0-123.el7.x86_64
Created attachment 940940[details]
test build
Give this test build a try, ends up it wasn't removing the last device on dm devices (same problem as bug 851705 in rhel6).
If you run into ioctl denied problems it may be necessary to comment out the kpartx line at the bottom of /usr/lib/udev/rules.d/62-multipath.rules due to bug 1136966
Appears to have solved the issue using parted via the commandline:
# parted /dev/mapper/mpatha mkpart primary ext2 1 100
Information: You may need to update /etc/fstab.
# ls
control mpathb1 mpathd1 mpathf1 mpathh1
mpatha mpathc mpathe mpathg rhel_marathon--01-home
mpatha1 mpathc1 mpathe1 mpathg1 rhel_marathon--01-root
mpathb mpathd mpathf mpathh rhel_marathon--01-swap
# parted mpatha rm 1
Information: You may need to update /etc/fstab.
[root@marathon-01 mapper]# ls
control mpathc mpathe mpathg rhel_marathon--01-home
mpatha mpathc1 mpathe1 mpathg1 rhel_marathon--01-root
mpathb mpathd mpathf mpathh rhel_marathon--01-swap
mpathb1 mpathd1 mpathf1 mpathh1
Will this fix be picked up by pyparted as well? I initially hit this with a python script which uses parted lib to prepare disks for testing.
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-0343.html