Solutions: RAID starting at md127 instead md0 issue


If you use software raid on Linux (I use Ubuntu). may someone wonder why after create raid to /dev/md0, but after reboot, raid device become to /dev/md127... Why?

That because you need to update Initramfs by command update-initramfs

 $sudo update-initramfs -u 

What's initramfs from Ubuntu Wiki
initramfs is the solution introduced for the 2.6 Linux kernel series. The idea is that there's a lot of initialisation magic done in the kernel that could be just as easily done in userspace.
At a first glance, it is only slightly different than a traditional initrd. Initramfs' are loaded quite a bit sooner than initrd's are.
The key parts of initramfs are:
  • CPIO archive, so no filesystems at all are needed in kernel. The archive is simply unpacked into a ram disk.
  • This unpacking happens before do_basic_setup is called. This means that firmware files are available before in-kernel drivers load.
  • The userspace init is called instead of prepare_namespace. All finding of the root device, and md setup happens in userspace.
  • An initramfs can be built into the kernel directly by adding it to the ELF archive under the section name .init.ramfs
  • initramfs' can be stacked. Providing an initramfs to the kernel using the traditional initrd mechanisms causes it to be unpacked along side the initramfs' that are built into the kernel.
  • All magic naming of the root device goes away. Integrating udev into the initramfs means that the exact same view of the /dev tree can be used throughout the boot sequence. This should solve the majority of the SATA failures that are seen where an install can succeed, but the initrd cannot boot.
More initramfs info here (https://wiki.ubuntu.com/Initramfs). Also command see update-initramfs as well


Here is short example to create raid-0 with 3 HDD, /dev/sdb, /dev/sdc, /dev/sdd
 $sudo mdadm --create --verbose /dev/md0 --level=0 --raid-devices=3 /dev/sdc /dev/sdb /dev/sdd  
 $sudo mdadm --detail --scan --verbose > /etc/mdadm/mdadm.conf  
 $sudo update-initramfs  
then reboot,  you will see /dev/md0, no /dev/md127 :)



Comments