[CentOS] Problem with mdadm, raid1 and automatically adds any disk to raid

Mon Feb 25 11:23:12 UTC 2019
Tony Mountifield <tony at softins.co.uk>

In article <20190225050144.GA5984 at button.barrett.com.au>,
Jobst Schmalenbach <jobst at barrett.com.au> wrote:
> Hi.
> 
> CENTOS 7.6.1810, fresh install - use this as a base to create/upgrade new/old machines.
> 
> I was trying to setup two disks as a RAID1 array, using these lines
> 
>   mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
>   mdadm --create --verbose /dev/md1 --level=0 --raid-devices=2 /dev/sdb2 /dev/sdc2
>   mdadm --create --verbose /dev/md2 --level=0 --raid-devices=2 /dev/sdb3 /dev/sdc3
> 
> then I did a lsblk and realized that I used --level=0 instead of --level=1 (spelling mistake)
> The SIZE was reported double as I created a striped set by mistake, yet I wanted the mirrored.
> 
> Here starts my problem, I cannot get rid of the /dev/mdX no matter what I do (try to do).
> 
> I tried to delete the MDX, I removed the disks by failing them, then removing each array md0, md1 and md2.
> I also did
> 
>   dd if=/dev/zero of=/dev/sdX bs=512 seek=$(($(blockdev --getsz /dev/sdX)-1024)) count=1024
>   dd if=/dev/zero of=/dev/sdX bs=512 count=1024
>   mdadm --zero-superblock /dev/sdX
> 
> Then I wiped each partition of the drives using fdisk.

The superblock is a property of each partition, not just of the whole disk.

So I believe you need to do:

mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdb2
mdadm --zero-superblock /dev/sdb3
mdadm --zero-superblock /dev/sdc1
mdadm --zero-superblock /dev/sdc2
mdadm --zero-superblock /dev/sdc3

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org