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
David Waller
  • 271
  • 1
  • 2
  • 5

3 Answers3

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 ;)

  • (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). – Keeley Hoek Jun 01 '23 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. – Keeley Hoek Jun 01 '23 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.

Kevin
  • 40,087
  • 16
  • 88
  • 112
Thomas James
  • 276
  • 3
  • 5
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.

poige
  • 6,195
  • 2
  • 30
  • 57