I've just been through massive dramas getting bootable RAID on a new Slackware installation so mdadm
is relatively fresh in my mind =) My system wouldn't even boot so I didn't have the "device busy" problem you have... But if you can make a bootable CD or USB, or have your original installation boot media lying around you can achieve this pretty easily.
Once booted, you can easily examine the status of your RAID devices:
mdadm -D --scan
mdadm -D /dev/md0
Check that the relevant disk is listed, try to mount and make sure all your files are there:
mount /dev/md0 /mnt
# have a browse through the contents of /mnt until you're satisfied
umount /mnt
Then try adding your disk. Presumably you have already set up the partitions to match the other one.
mdadm --add /dev/md0 /dev/sda1
And check the status again:
mdadm -D /dev/md0
Your disk should be listed, and it should say that it's doing a resync or rebuilding the array. It should also indicate its progress as a percentage.
Then, my advice is just walk away and leave it. Come back periodically and run the above command again until it is done. Mine took several hours. When it's done, the status should indicate you have two active devices, two working devices, and that the state is either 'clean' or 'active'.
At that point, issue a reboot command and boot to your raid device. I don't know about grub, but presumably you have taken steps to make that work. I use LILO, so I had to make an initrd
file that loaded the RAID drivers.
Good luck. It's nail-biting stuff reconfiguring your RAID when you only have one copy of your system =)
PS: I don't know how you'll go if you're using metadata version 1.20 with Ubuntu. In Slackware, this caused heaps of issues -- namely my devices renumbering themselves. I had to go through various iterations of zeroing the superblocks, recreating the array with metadata 0.90, forcing the super-minor to a value etc. If you have problems with /dev/md0
getting renumbered (as /dev/md127
for example) and then failing to boot, feel free to ask for help.