Ubuntu mdadm: “Device or resource busy” error

I have been upgrading my old fileserver today with new hardware and 4 new 2 TB Hitachi disks. I thought I’d set them up in a Raid 5 array. This is a new installation of Ubuntu Server 10.04 running on an Asus Deluxe mainboard with a SIL SATA controller with 6 SATA ports.

Firstly: The array was created with the command:

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=4 /dev/sd[bcde]

This all went well enough, but after a reboot, I got this error when trying to assemble the array:

mdadm: Cannot open /dev/sdb: Device or resource busy

Looking about a bit on the net I find this blogpost which is quite helpful: Righteous Hack: Device or resource busy when using mdadm. However it doesn’t quite solve my problem as I already thought of these options and double-checked them. Some further searching revealed this helpful post on ubuntuforums: Raid stops after restart (SOLVED). That did the trick! Turns out that one of the raid-disks (was random on my server) is attempted assembled during startup when mdadm doesn’t know what raid to assemble from the conf file. The solution is running the command:

mdadm --examine --scan --config=mdadm.conf >> /etc/mdadm/mdadm.conf

which produce this line in the mdadm.conf file:

ARRAY /dev/md0 level=raid5 num-devices=4 UUID=eb001a5c:9a62bf3b:1b3376be:99c3df95
spares=1

Now the raid comes up as it should after reboot.

As for the RAID setup, I used this guide: https://raid.wiki.kernel.org/index.php/RAID_setup

  1. Harddrive Failure and Monitoring | It's Forty Two! - pingback on October 11, 2011 at 18:13
  2. I had raid level 1(2 disks) and trying to add /dev/sdb5 to /dev/md1 (the swap) /dev/sdb5) was busy. After the scan and mod to /etc/mdadm/mdadm.conf, and reboot, /dev/sdb5 was no longer busy and I was able to mdadm /dev/md1 –add /dev/sdb5. Thanks
    Peter

Leave a Comment


*

Trackbacks and Pingbacks: