Thursday, May 7, 2009

forcing mdadm device names at boot

I had this fun problem when I upgraded my machine recently where the mdadm RAID array in my external enclosure would be detected before the RAID on my internal drives if the computer cold booted with the external enclosure turned on.  This created a problem because mdadm wanted to assign /dev/md0 to the array in the external enclosure, and LVM was expecting a different array to be there.

Setting the super-minor on the superblock of the array didn't seem to have much affect (from what I can tell it wasn't even being written).  The solution is to specify the UUIDs of the arrays with the device names you want in your mdadm.conf.  Here's what mine looks like:

dknowles@bender:~$ cat /etc/mdadm/mdadm.conf | grep ARRAY
ARRAY /dev/md1 level=raid1 num-devices=2 \
UUID=6e5ff2ae:5724fb93:a0a0eea7:e933aaa5
ARRAY /dev/md0 level=raid5 num-devices=3 \
UUID=40a6c7b8:76b2e648:a0a0eea7:e933aaa5
ARRAY /dev/md2 level=raid1 num-devices=2 \
UUID=e4977645:8fd7f50c:a0a0eea7:e933aaa5

Presto! Now from a cold boot, all the drives are detected normally. Which is good because now my backup cron will stop sending me error emails every night. On to the next, more interesting problem in my life! :)

0 comments:

Post a Comment