I recently cloned an old install from one server chassis to another via rsync. The old setup only had one disk and the new one is set up with two disks in a softraid. I managed to solve the problem and thought I’d present it here to benefit others.
attempting to add sda3 to md2 says:
mdadm: hot add failed for /dev/sda3: Invalid argument
md: could not bd_claim sda3.
md: error, md_import_device() returned -16
Drive is not mounted or in use by the OS. SMART error logs do not indicate any disk failures. I can boot up to a rescue CD and the array assembles just fine.
Go figure the old install used partition labels to determine the boot device. So GRUB grabbed the first disk /dev/sda, on which root was label “/” or device /dev/sda3. So GRUB kept /dev/sda3 busy so that mdadm couldn’t add it to the array.
Changing the root= device kernel param in grub.conf to the raid device md2 and re-rolling the initial ramdisk cleared up the problem. It boots fine and assembles a healthy softraid now.
Maybe it’s a stupid item to overlook, but it certainly gave me a head scratcher for a bit. Have a laugh … I certainly did when things were up and running properly again.