Tuesday, May 10, 2011

Linux Rescue: mdadm will not assemble arrays

I'm in the process of trying to fix a server with a dead motherboard where we used software RAID.  During one of the repair steps, I had to boot the CentOS install CD and use the "linux rescue" option because I need to do some editing to files on the hard drive to reflect the new disk layout.

Normally, you would expect this to be dead easy, just tell mdadm to assemble the arrays that you're interested in and then mount the file systems.  Instead, you're going to end up stuck on the following error:

mdadm --assemble /dev/md# /dev/sda# /dev/sdb#
mdadm: no devices found for /dev/md#

Why?  Because in CentOS / Red Hat rescue mode, mdadm requires the use of UUIDs and not device partition names.  So for every array that you want to mount (if you don't let the rescue CD do it automatically), you will have to use the format:

mdadm --assemble --uuid 01234568:90abcdef:01234568:90abcdef /dev/md#

To get the UUID, you can use the --examine option of mdadm.

mdadm --examine /dev/sda# | grep 'UUID'
UUID : 01234568:90abcdef:01234568:90abcdef

(This occurred with the CentOS 5.5 install CDs.)

3 comments:

Anonymous said...

Thanks! You saved me a lot of time :)

Anonymous said...

You are the man!

markjx said...

Thanks! That helped me out a bunch!