After my Buffalo NAS physically failed, I decided to go back to the good ole’ home brew files server / NAS. So I stripped out the 250GB drives from the NAS and set out to setup Linux software RAID which is also known as md RAID. I went this route because my hardware RAID controller currently in use by another system, and I wanted a little weekend project.
After loading Ubuntu 8.10 to a stand alone drive (/dev/sda) I went ahead and prepped the system for the RAID array. After getting the disks installed and formatted, I dropped to the command line and ran sudo apt-get install mdadm. Once that was complete I attempted to create a RAID 10 array using the following command:
sudo mdadm –verbose –create /dev/md0 –level raid10 –raid-devices=4 /dev/sdb /dev/sdc /dev/sdd /dev/sde
which failed and gave the following errors:
mdadm: Cannot open /dev/sdb1: Device or resource busy
mdadm: Cannot open /dev/sdc1: Device or resource busy
mdadm: Cannot open /dev/sdd1: Device or resource busy
mdadm: Cannot open /dev/sde1: Device or resource busy
mdadm: create aborted
After scouring Google and using every possible search term I could not find anything pointing the cause of the problem. I made sure the disks were not mounted, verified they were not in use, made sure that swapoff had been run on each disk, and generally tried everything. After playing around with different things it just kind of dawned on me, my onboard RAID controller might be interfering. Most people in the Linux world refer to onboard RAID’s as FakeRAID or FRAID. It appears that the Ubuntu installer detected the onboard Nvidia RAID controller and installed dmraid into the running kernel. If you must use FakeRAID, dmraid may be useful to you, if you want true Linux software RAID, you need mdadm.
To resolve this, make sure that you go into the BIOS for your FakeRAID and disable / remove / delete any arrays that may be configured. Afterwards, reboot and go into your motherboard BIOS and disable the onboard RAID controller. Make sure the port are still enabled, you just want the RAID functionality disabled. Lastly, go to the command line and run
sudo apt-get remove dmraid. This will remove the dmraid modules and update your boot image to not include the dmraid software.
Once you have completed the above, rerun your mdadm command and you should be off and running in no time.
16 thoughts on “Device or resource busy when using mdadm”
Thanks a bundle! I read all of the other tips as well and was getting really frustrated since I could not determine what was using the drives. Your post made my evening.
Thank you, thank you, thank you, I CANNOT thank you enough. After hours of banging my head against the keyboard I finally came across your wonder blog and discovered why mdadm kept telling me that my seemingly unused SATA drives are “busy.” You made my evening too!
You just saved me so much lost sleep/time/hair/dignity/self-worth I can go on and on. Thank you. I thought I was going crazy. You have also made my evening.
Thank you. Thank you. Thank you.
Like the other comments I was also near insanity trying to figure out why my devices were “busy” and my RAID wouldn’t not create/assemble/mount, etc. Now I can relax and enjoy my machine again.
Another life saved. Even though Ubuntu Server 9.10 was told to ignore hardware raid, it still installed dmraid. My machine required a reboot after removing dmraid and things started working. Thanks.
Thank you for the article. This indeed was the behaviour and the cause I was also experiencing.
Thank-you! removing dmraid fixed my problem of mdadm seeing devices a busy when they clearly weren’t.
Thank you !!!! I have the same problem whith a sil card 2TB disk and ebox 2.0 plataform over ubuntu 10.04. Now is working !!!!!.
THANK YOU! my array would not start up after upgrading from Ubuntu 8.04 to 10.04. This was exactly the problem. Disabled FakeRAID in BIOS, removed dmraid, rebooted, and everything was sweet again.
THANK YOU, This has been driving me crazy and has saved me too!!!!!
Oh My God!!!
Using a cheap SATA Raid card for the extra SATA connections.
Never had the ‘Device Busy’ before….
Read the post, checked the ‘FRAID’ on the card (never used) and there was NO raid devices configured of ANY description.
No FRAID on the motherboard.
After hours of trying stuff thought ‘What the hell, do not need dmraid so lets ‘yum erase dmraid’
Reboot and BANG! no more device busy.
‘mdadm –manage –add /dev/md# /dev/sdb# WORKEd at last….
I am on CentOS kernel2.6.18-238.9.1.el5.
‘lsof | grep in question’ reveals nothing.
lsmod | grep dmraid and no module loaded.
BUT still removing dmraid fixed the issue.
BUT MANY MANY thanks!!!
Thanks, that did the trick, couldnt figure out why my raid stopped working after doing a fresh install. removed dmraid and issue resolved
Thnx that was the issue for me as well
Can’t thank you enough! Been banging my head over this issue for hours.