Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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...

share|improve this question
    
What type of RAID is that (0, 1, 5)? In any case, I ust modified my answer. –  Sunny Jul 1 '11 at 15:16
    
It's RAID 1 array. –  Alexis Dufrenoy Jul 1 '11 at 15:30
    
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. –  Sunny Jul 1 '11 at 15:33
    
Some more infos. –  Alexis Dufrenoy Jul 1 '11 at 15:47
    
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 Jul 1 '11 at 16:06

3 Answers 3

up vote 2 down vote accepted

/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.

share|improve this answer
    
Thank you. But I'm still not able to remove sda5. I edited the question... –  Alexis Dufrenoy Jul 1 '11 at 15:07
    
Ok, we changed the sdb, which is the one who is broken, and the recovery is in process. Everything back on track. Thank you! –  Alexis Dufrenoy Jul 1 '11 at 16:04

I delete partition table:

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

then reboot then it works.

share|improve this answer

I had the same problem and after trying zillion things, this worked for me:

mdadm --manage --stop /dev/md0

That totally removed md0 from the array.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.