17

I'm trying to script the RAID setup for a (growing) number of identical servers. The advice I've seen for using mdadm suggests that once the RAID array has been created you can run mdadm --examine --scan >> /etc/mdadm.conf so that the array is initialised on bootup. But that doesn't seem to work for me - in particular the array is presented as /dev/md/<hostname>:pool, where the mdadm --examine outputs /dev/md/pool.

Am I doing something wrong? Is there something odd about my version of mdadm?

[root@positron /]# mdadm --create /dev/md0 --level=0 --name=pool --raid-devices=6 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
[root@positron /]# mdadm --examine --scan
ARRAY /dev/md/pool metadata=1.2 UUID=567da122:fb8e445e:55b853e0:81bd0a3e name=positron:pool
[root@positron /]# ls /dev/md/*
/dev/md/md-device-map  /dev/md/positron:pool
[root@positron /]# cat /dev/md/md-device-map
md127 1.2 22a17d56:5e448efb:e053b855:3e0abd81 /dev/md/positron:pool
[root@positron /]# mdadm --version
mdadm - v3.1.3 - 6th August 2010
4
  • Are you running udev? I've come across a few issues on debian where udev wasn't assigning the right device. Nov 3, 2011 at 12:34
  • Yes, on RHEL rather than Debian, but running udev. Not sure quite what to do with this tip, but I'll go Googling. Nov 3, 2011 at 13:38
  • Do you get problems when omitting the --name option during creation?
    – Nils
    Nov 7, 2011 at 21:19
  • I think in that case I got /dev/md/positron:0 Nov 22, 2011 at 16:50

3 Answers 3

29

And here's the fix, I'm not entirely clear on why it works, but it does!

After updating your mdadm file following the RAID array creation - usually with something like mdadm --detail --scan >> /etc/mdadm/mdadm.conf

Simply run the following command update-initramfs -u

Then reboot, and everything will work as expected.

Voila ;)

2
  • (Very old, but:) the reason this is necessary because without update-initramfs -u the array is being assembled early in the boot process via some "autodiscovery"-like mechanism, before / is mounted (and so /etc/mdadm/mdadm.conf can't be read). Whereas running update-initramfs -u copies your mdadm.conf file into the initramfs so that it can be read early (mdadm installs a hook script which copies the file). Jun 1 at 18:30
  • When mdadm isn't sure that the array it is assembling is supposed to be assembled on your specific host (e.g. when it couldn't find the array in mdadm.conf) then it prepends the hostname to the name of the array, as is happening to you. Jun 1 at 18:33
1

I've found that I've had to manually edit both the mdadm.conf and udev.conf to get the manual device names to hold.

However, I've not found it to be an issue one LVM is layered on top.

0

I don't see what's the problem. Array will be assembled on boot okay, even if it would be only mentioned with its UUID.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .