mdadm errors

Problem:

Scan shows your Array, but Assemble fails.

root@nas:~# mdadm --examine --brief --scan --config=partitions
ARRAY /dev/md0 level=raid0 num-devices=2 UUID=fa2d2080:63078209:c7780c0e:bc15422d

root@nas:~# mdadm --assemble /dev/md0 /dev/sda1 /dev/sdb1
mdadm: cannot open device /dev/sda1: Device or resource busy
mdadm: /dev/sda1 has no superblock - assembly aborted



Solution:

Fail the array, remove the members and recreate

Procedure

Determine what mdadm thinks is going on

root@nas:~# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md_d0 : inactive sda1[0](S)
      976759936 blocks

unused devices: <none>


Fail the array and recreate it

root@nas:/etc/mdadm# mdadm --manage --stop /dev/md_d0
mdadm: stopped /dev/md_d0

root@nas:/etc/mdadm# mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 --chunk=4 /dev/sda1 /dev/sdb1
   
    ... Other Possible mdadm errors
        ...
Continue creating array? y
mdadm: array /dev/md0 started.

Reformat the arrary

 mkfs.ext4 /dev/md0 -m 0


In case of real problems, delete the superblocks and try again

root@nas:~# mdadm --zero-superblock /dev/sdb1
mdadm: Couldn't open /dev/sdb1 for write - not zeroing


If that fails, you may have the device mapped somewhere else, and you need to close it as this     


root@nas:~# ls /dev/m*
/dev/mem

/dev/mapper:
control  crypt-part
root@nas:~# cryptsetup luksClose crypt-part







root@nas:~# mdadm --examine --brief --scan --config=partitions

Links

Remove a raid array with mdadm

http://ubuntuforums.org/showthread.php?t=122743

http://www.mail-archive.com/linux-raid@vger.kernel.org/msg10697.html

http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/
Comments