Impossible to stop raid device

23,952

Solution 1

/dev/md1 is the RAID array itself. You need to stop a particular participant in that array. Try:

mdadm --fail /dev/md0 /dev/sda1
mdadm --remove /dev/md0 /dev/sda1

This is a good resource: http://www.excaliburtech.net/archives/19

If you need to move all the participating devices, then you need to do this one by one, waiting for the array to rebuild after each device swap.

Solution 2

I delete partition table:

dd if=/dev/zero of=/dev/md0 bs=512 count=1024

then reboot then it works.

Solution 3

In my case i have to do some more tricks for XEN Server

Step # 1 dd if=/dev/zero of=/dev/md0 bs=512 count=1024

Step # 2 -- Reboot the server

Step # 3

[root@localhost ~]# mdadm --stop /dev/md0 --force

and then

[root@localhost ~]# mdadm --remove /dev/md0 --force
Share:
23,952

Related videos on Youtube

Alexis Dufrenoy
Author by

Alexis Dufrenoy

I'm a french software engineer and software architect. I work mainly with Java (JavaEE, Spring), Javascript (Angular, ExtJS) and RDBMS (MySQL, PostSQL, Oracle, Sybase, Teradata). I also have knowledge in Typescript, C, C++, shellscript, social network application programming (Facebook, Opensocial, Twitter), image processing, payment solutions implementation (Paypal) and more. About personal projects: I started the french wikibook on programming (yeah, back in 2004 or something). I was very involved at different levels in Wikipedia and sister projects for 5 years, until 2008. Consumed most of my spare time, then. But it was worth it. I'm also a real free software maniac. Free as in free speech... My other center of interest are photography (I got a Canon 7D I'm having real fun with. I took the picture of a polar fox I'm using as an avatar with my older 350D), cooking (I'm french, after all :-) and seeing museums, especially art (I can't grow tired of the Marmottan Museum and its unique Monet paintings collection). My 2 mother tongues are french and german, and apparently I'm not all so bad in english... :-). Beside France, I worked in Germany and Switzerland (where I also lived).

Updated on September 18, 2022

Comments

  • Alexis Dufrenoy
    Alexis Dufrenoy almost 2 years

    I'm trying to stop a RAID disk in order to replace it by a new one, as this one is not working properly.

    I'm typing mdadm --stop /dev/md1, and I'm getting an error message:

    mdadm: fail to stop array /dev/md1: Device or resource busy
    

    I'm getting this message even if I reboot the server, and I can't see a process that could cause this.

    The server is working under a Debian with a 2.6.18-4-amd64 kernel. Could you help?

    Edit: More details about what my colleague tried out.

    After unmounting sda1, the command mdadm --remove /dev/md0 /dev/sda1 worked. But now, we still have an error message after mdadm --remove /dev/md1 /dev/sda5:

    mdadm: hot remove failed for /dev/sda5: Device or resource busy
    

    I still don't understand completly how the different partitions are mounted, so I suppose there is something I don't understand in the currenct situation...

    • Alexis Dufrenoy
      Alexis Dufrenoy about 13 years
      It's RAID 1 array.
    • Sunny
      Sunny about 13 years
      You can not stop both devices at the same time, while in use. If you can not stop the array itself by unmounting whatever partitions are mounted on it and then stopping it, you will need to migrate device by device.
    • Alexis Dufrenoy
      Alexis Dufrenoy about 13 years
      Some more infos.
    • Alexis Dufrenoy
      Alexis Dufrenoy about 13 years
      Surprisingly, many tutorials or how-to pages indicate to remove both disks form the array, which is very misleading. Thank you again, Sunny.
  • Alexis Dufrenoy
    Alexis Dufrenoy about 13 years
    Thank you. But I'm still not able to remove sda5. I edited the question...
  • Alexis Dufrenoy
    Alexis Dufrenoy about 13 years
    Ok, we changed the sdb, which is the one who is broken, and the recovery is in process. Everything back on track. Thank you!
  • Matthias Urlichs
    Matthias Urlichs over 9 years
    ? "--manage --stop" is the exact same thing as "--stop", so I fail to see how that would fix the problem.