• Re: Removing an unwanted RAID 1 array

    From Michel Verdier@21:1/5 to Roger Price on Sat Jan 11 12:50:01 2025
    On 2025-01-11, Roger Price wrote:

    root@titan ~ umount /dev/md4
    root@titan ~ mdadm --misc /dev/md4 --stop
    root@titan ~ mdadm --manage /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    If I remember well you have to first set the device as faulty with --fail before --remove could be accepted. But if this is the last device you can
    erase the partition to remove RAID informations.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roger Price@21:1/5 to All on Sat Jan 11 12:20:07 2025
    I am unable to erase an unwanted RAID 1 array. Command cat /proc/mdstat reported

    md4 : active raid1 sdb7[0]
    20970368 blocks super 1.0 [2/1] [U_]
    bitmap: 1/1 pages [4KB], 65536KB chunk

    I understand that the array has to be inactive before it can be removed, so I stopped it, but was not able to remove the array

    root@titan ~ umount /dev/md4
    root@titan ~ mdadm --misc /dev/md4 --stop
    root@titan ~ mdadm --manage /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    The command ps -ef | grep md4 reports

    root 211 2 0 Jan09 ? 00:00:00 [md4_raid1]

    I assume process 211 is keeping md4 busy. Do I have to kill process 211 or is there some more elegant way? Or is it mdadm itself in process 663 which is keeping md4 busy?

    root 663 1 0 Jan09 ? 00:00:00 /sbin/mdadm --monitor --scan

    The documentation I have found shows lots of examples of building RAID 1 arrays,
    but not removing them. The program mdadm does not have a --disassemble mode. Any suggestion would be much appreciated.

    Roger

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roger Price@21:1/5 to Michel Verdier on Sat Jan 11 13:20:01 2025
    On Sat, 11 Jan 2025, Michel Verdier wrote:

    If I remember well you have to first set the device as faulty with --fail before --remove could be accepted.

    No luck :

    root@titan ~ mdadm --fail /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    But if this is the last device you can erase the partition to remove RAID informations.

    I intend to erase the partition, but I hoped for something cleaner from an mdadm
    RAID management point of view.

    Roger

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Greg Wooledge@21:1/5 to Roger Price on Sat Jan 11 15:30:02 2025
    On Sat, Jan 11, 2025 at 13:10:51 +0100, Roger Price wrote:
    On Sat, 11 Jan 2025, Michel Verdier wrote:

    If I remember well you have to first set the device as faulty with --fail before --remove could be accepted.

    No luck :

    root@titan ~ mdadm --fail /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    Is it mounted? Is it being used as swap?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roger Price@21:1/5 to Greg Wooledge on Sat Jan 11 16:00:01 2025
    This message is in MIME format. The first part should be readable text,
    while the remaining parts are likely unreadable without MIME-aware tools.

    On Sat, 11 Jan 2025, Greg Wooledge wrote:

    On Sat, Jan 11, 2025 at 13:10:51 +0100, Roger Price wrote:
    On Sat, 11 Jan 2025, Michel Verdier wrote:

    If I remember well you have to first set the device as faulty with --fail before --remove could be accepted.

    No luck :

    root@titan ~ mdadm --fail /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    Is it mounted? Is it being used as swap?

    No it's not mounted - I ran umount /dev/md4. It's not being used as swap.

    rprice@titan ~ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    ...
    „€sdb7 8:23 0 20G 0 part
    „€md124 9:124 0 20G 0 raid1

    I tried commenting out the entry for md4 in /etc/mdadm/mdadm.conf . I then ran update-initramfs -u as instructed in the mdadm.conf file.
    I then rebooted, but md4 reappeared as /dev/md124.

    Roger

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From pocket@homemail.com@21:1/5 to All on Sat Jan 11 16:50:01 2025
    Sent: Saturday, January 11, 2025 at 9:51 AM
    From: "Roger Price" <debian@rogerprice.org>
    To: "debian-user Mailing List" <debian-user@lists.debian.org>
    Subject: Re: Removing an unwanted RAID 1 array

    On Sat, 11 Jan 2025, Greg Wooledge wrote:

    On Sat, Jan 11, 2025 at 13:10:51 +0100, Roger Price wrote:
    On Sat, 11 Jan 2025, Michel Verdier wrote:

    If I remember well you have to first set the device as faulty with --fail
    before --remove could be accepted.

    No luck :

    root@titan ~ mdadm --fail /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    Is it mounted? Is it being used as swap?

    No it's not mounted - I ran umount /dev/md4. It's not being used as swap.

    rprice@titan ~ lsblk
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
    ...
    └─sdb7 8:23 0 20G 0 part
    └─md124 9:124 0 20G 0 raid1


    findmnt



    I tried commenting out the entry for md4 in /etc/mdadm/mdadm.conf . I then ran
    update-initramfs -u as instructed in the mdadm.conf file.
    I then rebooted, but md4 reappeared as /dev/md124.

    Then is probaly systemd
    Do you have the array in /etc/fstab?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael Stone@21:1/5 to Roger Price on Sat Jan 11 18:50:01 2025
    On Sat, Jan 11, 2025 at 12:11:39PM +0100, Roger Price wrote:
    I am unable to erase an unwanted RAID 1 array. Command cat /proc/mdstat reported

    md4 : active raid1 sdb7[0]
    20970368 blocks super 1.0 [2/1] [U_]
    bitmap: 1/1 pages [4KB], 65536KB chunk

    I understand that the array has to be inactive before it can be removed, so I >stopped it, but was not able to remove the array

    root@titan ~ umount /dev/md4
    root@titan ~ mdadm --misc /dev/md4 --stop

    This is incorrect syntax, and a no-op (so the array did not stop). You
    want `mdadm --misc --stop /dev/md4`. The --misc is implied so you can
    just use `mdadm --stop /dev/md4`

    root@titan ~ mdadm --manage /dev/md4 --remove /dev/sdb7
    mdadm: hot remove failed for /dev/sdb7: Device or resource busy

    This won't work and isn't necessary. (If md4 is actually stopped, it'll
    say that it md4 doesn't exist. If md4 isn't stopped you'll get the
    message above because you can't remove an active drive from an array.)

    The command ps -ef | grep md4 reports

    root 211 2 0 Jan09 ? 00:00:00 [md4_raid1]

    I assume process 211 is keeping md4 busy. Do I have to kill process 211 or is >there some more elegant way? Or is it mdadm itself in process 663 which is >keeping md4 busy?

    That's the kernel thread associated with the raid device. You can
    not/should not kill it. (The [] and the fact that the parent pid is 2
    are indicators that it is a kernel thread.)

    To remove the raid device you want to check the details `mdadm -D
    /dev/mdX` then stop it `mdadm -S /dev/mdX` and then zero the information
    on the devices identified in the details, something like `mdadm --zero-superblocks /dev/sdXN /dev/sdYN`. If the stop step fails you can
    try `fuser /dev/mdX` and `fuser -m /dev/mdX` to identify why, as well as
    `grep mdX /proc/mounts`

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roger Price@21:1/5 to Michael Stone on Sun Jan 12 12:00:01 2025
    On Sat, 11 Jan 2025, Michael Stone wrote:

    root@titan ~ mdadm --misc /dev/md4 --stop

    This is incorrect syntax, and a no-op (so the array did not stop). You want `mdadm --misc --stop /dev/md4`. The --misc is implied so you can just use `mdadm --stop /dev/md4`

    I ran the command

    root@titan ~ mdadm --misc --stop /dev/md124
    mdadm: stopped /dev/md124

    md124 has now disappeared from cat /proc/mdstat. I also updated /etc/fstab, ran
    systemctl daemon-reload, updated /etc/mdadm/mdadm.conf and ran update-initramfs -u .

    Thanks, Roger

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)