I had this problem on my Raspberry Pi 2 running Raspbian GNU/Linux 8 (jessie). I had a RAID array on /dev/sda1
and /dev/sdb1
which failed to assemble at boot. I had in my /etc/mdadm/mdadm.conf
file the entry
ARRAY /dev/md/0 metadata=1.2 UUID=53454954:4044eb66:9169d1ed:40905643 name=raspberrypi:0
(your numbers will be different; see other answers on how to get this.)
I had in my /etc/fstab
file the entry
/dev/md0 /data ext4 defaults 0 0
(and of course /data
indeed existed)
Like the OP, I could assemble and mount the RAID array by hand after boot, but I could not get it to happen automatically during boot despite apparently correctly setting it up.
I was able to solve the problem as follows. I investigated the script at /etc/init.d/mdadm-raid
and inserted a line of debug code
ls /dev > /home/pi/devices.txt
Rebooting and checking this file I learned that devices /dev/sda
and /dev/sdb
existed at the time the mdadm-raid
initialization happened, but the partitions /dev/sda1
and /dev/sdb1
were missing. I edited the /etc/init.d/mdadm-raid
file and inserted the line
partprobe
after the header (i.e. after the ### END INIT INFO
but before the script begins). This caused the partitions to be detected and so the mdadm-raid
script was able to assemble the RAID array, resolving the problem. Hope this helps someone!
1@LennartRolland - try
mdadm -Es
instead. – slm – 2015-01-09T01:00:34.453this did not work for me, I had to do
grub-install /dev/sda
to make it work (replace sda for anything appropriate for you) – gorn – 2016-04-25T23:17:07.103Alternatively you can just use the kernel option:
– Pryftan – 2019-10-14T18:39:47.693md.auto=1
... I haven't actually tested this thoroughly but supposedly it detects them and assembles them (or at least tries to do so). But then https://www.kernel.org/doc/html/v4.15/admin-guide/md.html is a bit ambiguous on that: When md is compiled into the kernel (not as module), partitions of type 0xfd are scanned and automatically assembled into RAID arrays. [...] As of kernel 2.6.9, only drives with a type 0 superblock can be autodetected and run at boot time. And it doesn't refer to md.auto (or whatever it was) so I'm not sure now.7I would maybe add: you should also update your initramfs with
update-initramfs -u
– Pablo Montepagano – 2012-10-19T03:08:02.2331mdadm --detail --scan does not print anything on my system, although I know for sure that I have two partitions that are part of a raid0 (mirror). Any general advice on this is welcome. – Lennart Rolland – 2014-03-14T13:59:48.303