# ls /dev/md* /dev/md0 /dev/md1 # dd if=/dev/zero of=/dev/sdb3 bs=1M count=1 # dd if=/dev/zero of=/dev/sdd3 bs=1M count=1 # mdadm --zero-superblock /dev/sdb3 # mdadm --zero-superblock /dev/sdd3 # mdadm --create -l 1 -n 2 /dev/md2 /dev/sdb3 /dev/sdd3 mdadm: cannot open /dev/sdb3: Device or resource busy # ls /dev/md* /dev/md0 /dev/md1 /dev/md127 /dev/md2 # mdadm -D /dev/md127 mdadm: md device /dev/md127 does not appear to be active.
I did not ask it to auto detect and assemble anything. I didn't reboot either.
I moved around partitions many times on these disks to try different setups. So there are probably traces of those experiments things everywhere.
sdb3 is not busy. I just created it seconds before like this:
swapoff -a parted /dev/sdb rm 4 (my old raid10 + lvm) parted /dev/sdb rm 3 (my old swap) parted /dev/sdd unit s mkpart root4 503808 5860533118 (start here is same as swap start, and end is same as raid10+lvm end) parted /dev/sdd set 3 raid on
Also, if I created a device that had only /dev/sdd3, the --create command would also print this:
mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=0.90 Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md2 started.
But it also prints that now, after "-l 1" works again, without the "device or resource busy" message. (and that disk has a bios_grub and boot raid1 partition that has metadata 0.90, but this sdd3 is not related to boot).
I can't reproduce this now though... I tried several times and reproduced it fine, but after trying with "-l 0" instead, it works. "-l 10" has the same effect as "-l 1".
Why does md127 appear?
Why also md2 if it failed to create it?
In the future, other than using:
- dd to zero the start of the block device
- mdadm --zero-superblock
- and creating with "-l 0" (which is a nonsense solution)
what else can I do to clean up the disk to prepare it for "--create"?