1 Reply Latest reply on Nov 17, 2012 8:02 AM by Dude!

    Installing Bootloader and Linux LVM and RAID

      I'm experimenting with a Oracle Linux 6.3 (x86_64) installation in Virtualbox
      with 4 virtual harddrives, each 12 GB (dynamic)

      I have a question about the Boot Loader configuration.

      The drives/partitions are as following:

      1. Choose custom when prompted to setup the partition
      2. Created 6 individual RAID partitions:
      sda1 (500 MB), sda2 (11500 MB)
      sdb1 500 MB), sdb2 (11500 MB)
      sdc1 (12000 MB), sdd1 (12000 MB)
      3. Created 3 RAID-1 devices:
      md0 - sda1, sdb1 (/boot, ext4)
      md1 - sda2, sdb2 (LVM, -)
      md2 - sdc1, sdd1 (LVM, -)
      4. Created a LVM volume (vg_vm060)
      md1, md2
      5. Created LVM volumes:
      lv_swap (6000 MB)
      lv_root (18000 MB)

      md0 /boot
      LVM (md1/md2: /root /swap)

      As far as I understand or imagine, the boot process under Linux works the following way:

      When the system powers on, the BIOS scans sector 0 for executable code. Sector 0 is the location of the MBR (Master Boot Record) on a hard drive with a legacy partition scheme. Systems that use MBR have typically a system BIOS. GPT (GUID) systems use EFI (64-bit) and do not support MBR.

      The storage device the system uses to scan sector 0 depends on the selected bus adapter in the BIOS settings (boot order). The bus adapter in turn may provide an option to select the boot device (RAID controller) or use the first drive attached (/dev/sda or /dev/hda). Virtualbox allows me to select the boot order, but not the drive, defaulting to the first it finds attached, e.g. /dev/sda.

      The MBR is very small and cannot be used to contain the OS, but it can refer to the physical location (partition) of the operating system images or load a boot loader, e.g. the Linux Grub boot loader. The Grub boot loader in turns provides a menu to select the operating system. The Grub configuration and Linux system files are stored in the boot partition. The boot partition needs to have the "bootable" flag set and must be a partition that the MBR and system BIOS supports. It cannot be a LVM volume or Linux RAID device, for instance, and its size is limited by the BIOS or controller architecture, e.g. first 512 MB or 8 GB of the physical hard drive.

      Is the above correct?

      The installer of the OS (DVD) prompts for selecting the Boot Loader, which can be:

      - MBR (Master Boot Record) (recommended)
      - RAID Device (md0)
      - BIOS Drive order

      I checked the standard installation guide to find an explanation and answer, but what I found is rather vague (or I'm stupid).

      When the installation prompts for the boot loader, I guess it prompts to replace the existing MBR (sector 0) to support GRUB, or install code to load the Grub boot loader in another partition, which of course means the existing MBR must support it, e.g. another boot loader. However, the installer prompt does not mention MBR.

      What is the story?

      Another question is about Linux RAID support. I cannot install the boot loader onto a RAID (MD) device. Obviously the Linux OS needs to start first to provide support. What happens if I have a Linux RAID and one drive fails? I guess If I'm lucky and it is the drive that contains the appropriate MBR the system will start. However, if not, I have to boot from DVD and re-install Grub. Is this right?


      Edited by: Dude on Nov 15, 2012 2:28 PM
        • 1. Re: Installing Bootloader and Linux LVM and RAID
          I continued to do a bit more reserach and actually found the Grub boot loader explained in more details in the Appendix E and F of the installation guide. As such, what I understood and described so far seems ok. But I stumbled over the following:

          GRUB cannot construct a software RAID. Therefore, the /boot directory must reside on a single, specific disk partition. This is true even if the disk is mirrored in a level 1 RAID. The following Red Hat Knowledgebase article describes how to make the system bootable from another disk in the mirrored set: http:// kbase.redhat.com/faq/docs/DOC-7095. Unfortunately the document cannot be opened without a subscription. I wonder if it was enough just to copy the MBR using dd as described here: http://www.cyberciti.biz/faq/howto-copy-mbr or if there are other things necessary.

          The system I setup for experimenting uses MD RAID-1 for the /boot partition. The boot loader (MBR) is installed on /dev/sda. So far it works fine. But I assume the system is not using the software RAID (md0) during the startup process, but rather the individual partition (sda1).