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