I'm trying to setup a bootable software RAID that will contain the root filesystem and boot up Linux Mint Qiana. It will be used to run a few graphical monitoring applications in a small datacenter, as well as a simple terminal to access other LAN nodes.
I have two 500GB SATA drives (/dev/sda
and /dev/sdb
) which I will use to construct the RAID 1 Array. There seems to be many ways to do this, but it's a bit unclear to me how to create a md0
device that is bootable.
My first approach was to boot using a Live Linux Mint installation CD. I would then switch over to a bash prompt and manually partition /dev/sda
using sfdisk
. I created a simple partition table which included a single primary partition, along with a swap partition. I then simply cloned the partition table from /dev/sda
to /dev/sdb
:
sfdisk -d /dev/sda | sfdisk /dev/sdb
Okay, so now I have two drives ready to be assembled into a RAID array. I first create the array by saying:
mdadm --create --verbose --metadata=0.90 /dev/md0 --level=mirror
--raid-devices=2 /dev/sda /dev/sdb
About an hour later, the array is finished syncing.
I can now initialize /dev/md0
by giving it a filesystem:
mke2fs -t ext4 /dev/md0
Okay, so now everything seems good. So, I switch back to the Live CD installation, and install Linux onto /dev/md0
. Everything works until the installer attempts to run grub-install
, after which it receives a fatal error.
So, I've been researching around trying to understand the cause here. I'm not entirely sure why this happens, but my understanding is that it has something to do with the fact that "one does not simply boot from /dev/md0
". It seems that in order to create a bootable multi-device RAID 1 array, you need to either create a separate non-RAID /boot
partition, or use initramfs
.
Unfortunately, I don't exactly understand what this entails. Firstly, I don't want to create a separate non-RAID /boot
partition, because the whole boot of booting from md0
is for the redundancy. Secondly, my understanding is that the initramfs
approach is necessary to load mdadm
into the rootfs at boot time. But, when I boot from the Live CD and create my RAID array, mdadm
is already loaded into memory, so I don't understand why the installer always gets a fatal error when running grub-install
.
Can someone explain what steps I'm missing here, or provide an outline of how to setup a multi-device mount that can boot?
/boot
partition and boot from it. Grub isn't actually using it as RAID-1 when booting (i.e. Grub is just treating it as a non-RAID volume). Linux handles RAID and syncs the two/boot
partitions. In the event of a failure you can boot fine off the second disk because it has an identical copy of the original/boot
partition. AFAIK, all the concerns re: an using initramfs to boot relate to booting from RAID-5. RAID-1 is easy to boot from. – Evan Anderson Oct 8 '14 at 16:59/boot
partition? Why not have /boot on the primary partition? – Siler Oct 8 '14 at 17:16