0

Please note the edit at the end

I'm building a home server (my first attempt at it) using Ubuntu Server 14.04.1 on an old machine (BIOS doesn't support UEFI), and I want to set up the whole system on RAID5 using 3 empty disks (3TB each). I won't be installing any other OS on that machine.

I mostly followed the steps outlined by this guide, except that my understanding was that grub2 supports both mdadm-created RAID and LVM2, and therefore no tinkering with /boot partitions is necessary (based on answers such as this; same user--@psusi--also commented on AskUbuntu to the same effect). Hence, I set the following partitioning scheme:

  • Each drive has a single partition spanning as much of the drive as the server-live-installer would use (some 1MB remained unused at the end of each drive). I'll reiterate that my system doesn't support UEFI, so I'm left to assume the live-installer created an MBR table on all drives. These partitions are marked to be used in RAID.

  • A single RAID5 device md0 is created with these 3 partitions.

  • A single LVM physical volume fills md0. It has a single volume group srv-vg1, which contains 3 logical volumes:

    1. srv-lvboot contains 5GB and is used as ext4 and mounted as /boot

    2. srv-lvswap contains 20GB (intentional overkill) and is used as LUKS with a random key, on which I created a single linux-swap partition (mounted as swap).

    3. srv-lvroot spans the rest of the logical group and is used as LUKS with passphrase, on which I created a single ex4 partition mounted as /.

Using this partitioning scheme I continued with the installation, until I was prompted to Install the GRUB boot loader to the master boot record (of my first drive). I tried to continue, but an error message returned:

Unable to install GRUB in /dev/sda

Executing 'grub-install /dev/sda' failed.

This is a fatal error.

I can go back and attempt to install GRUB to a different device, but I don't know which one to choose (if I install it to md0 or srv-lvboot, assuming it would even work, wouldn't I then need to chainload it from another bootloader?). Also, I'm not 100% sure my partitioning scheme is viable. Can anyone assist?


Edit:

I eventually discovered that the reason why grub cannot install to the MBR of my first disk was because my disks (at 3TB) had a GPT table, so I should've created a 2MB partition with the bios_grub flag at the beginning of each drive. After doing that, the installation completes without errors. However, my server doesn't boot into Ubuntu. Rather, it keeps rebooting (apparently grub fails to load into the OS, for some reason). I attempted to use boot-repair to solve the issue, without success (it reportedly saved its logs to http://paste.ubuntu.com/9414135).

2 Answers 2

3

As it turns out, the true underlying issue was that added at the end of my question: since the machine doesn't boot from UEFI, grub requires a dedicated partition (2MB is reportedly more than enough) with the "bios_grub" flag at the beginning of each drive (each drive you plan on being able to boot from if the array ever became degraded, at least). One can set those up in the live-installer by choosing to use those partitions for bios boot.

(The reason this fix didn't initially work for me was that I created the partitions using another live-cd prior to running the Ubuntu Server installer, which messed things up a little.)

I'd like note @kyodake's reminder regarding the necessity of installing grub to the MBR's of the rest of the disks in your RAID array (I find that manually running sudo grub-install /dev/sdX is fastest). Finally, for completeness sake I'll stress that the reason for the separate /boot partition is that this way one can encrypt the rest of the filesystem (as outlined in the guide I linked to, and summarized in my own partitioning scheme). If one isn't inclined to implement full-volume-encryption, there's really not a good reason to create a separate partition.

1
  • Your insights helped me to get onto the right track (the installer failed to install grub into the MBR for the same reasons - GPT). As my machine did not want to boot after successful installation of grub2, thanks to your posts, I found out that some (faulty?) BIOSes expect a boot flag for legacy support which the installers partioning tool did not want to set - so I set my server up with an EFI Partition, and now I'm finally good!
    – variona
    Dec 22, 2015 at 9:40
1

Grub2 is fully RAID and LVM aware.

In fact you do not need a separate /boot partition at all.

You need also grub-install to all of the drives in the raid5.

The Ubuntu grub-pc package will prompt you to check off all of the drives you want it installed on and install it for you.

1
  • Thanks. You'll note I was counting on that, but the live-usb nevertheless failed to install grub to my first drive's MBR. That is my issue. Dec 7, 2014 at 15:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .