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 2041837

Summary: mdadm -r (short parameter) ignored
Product: Red Hat Enterprise Linux 8 Reporter: Jan ONDREJ <ondrejj>
Component: mdadmAssignee: Nigel Croxon <ncroxon>
Status: CLOSED ERRATA QA Contact: Fine Fan <ffan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, dledford, ffan, jwboyer, ncroxon
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2083951 (view as bug list) Environment:
Last Closed: 2022-05-10 15:29:19 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:
Bug Depends On:    
Bug Blocks: 2083951    

Description Jan ONDREJ 2022-01-18 11:08:45 UTC
Description of problem:
Using short parameter for mdadm -r (remove device) doesn't work. It's silently ignored. Tested on multiple centos8 stream servers.

Version-Release number of selected component (if applicable):
mdadm-4.2-rc3.el8.x86_64

How reproducible:
always

Steps to Reproduce:
1. create/assemble /dev/md0 device
2. mdadm --manage /dev/md0 -r /dev/vdxxxx

Actual results:
Nothing, empty output, nothing happens, device is still contents of the array.

Expected results:
Should write at least an error, that device doesn't exist or display success.
mdadm: stat failed for /dev/vdxxx: No such file or directory

Additional info:
Using --remove instead of -r works, but according to documentation -r should work too and some script are already using it.

Some examples:
[root@srv ~]# mdadm /dev/md1 -r /dev/vdxxx
[root@srv ~]# mdadm --manage /dev/md1 -r /dev/vdxxx
[root@srv ~]# mdadm --manage /dev/md1 --remove /dev/vdxxx
mdadm: stat failed for /dev/vdxxx: No such file or directory
[root@srv ~]#

Comment 1 Nigel Croxon 2022-02-10 14:08:08 UTC
https://www.spinics.net/lists/raid/msg69409.html

Comment 4 Fine Fan 2022-02-25 17:53:10 UTC
I think this issue is fixed on mdadm-4.2-2.el9.x86_64

[root@localhost ~]# mdadm /dev/md0 -r /dev/vdb2 
mdadm: hot removed /dev/vdb2 from /dev/md0
[root@localhost ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINTS
sr0          11:0    1 1024M  0 rom   
vda         252:0    0   10G  0 disk  
├─vda1      252:1    0    1G  0 part  /boot
└─vda2      252:2    0    9G  0 part  
  ├─cs-root 253:0    0    8G  0 lvm   /
  └─cs-swap 253:1    0    1G  0 lvm   [SWAP]
vdb         252:16   0   10G  0 disk  
├─vdb1      252:17   0  953M  0 part  
│ └─md0       9:0    0  952M  0 raid1 
└─vdb2      252:18   0  953M  0 part  
[root@localhost ~]# rpm -q mdadm
mdadm-4.2-2.el9.x86_64
[root@localhost ~]#

Comment 5 Jan ONDREJ 2022-04-12 07:51:55 UTC
Same problem on Fedora 35, mdadm-4.2-1.fc35.x86_64.

Comment 8 errata-xmlrpc 2022-05-10 15:29:19 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 (mdadm bug fix and enhancement update), 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-2022:2087