Ubuntu – How to install Ubuntu server with UEFI and RAID1 + LVM


I used to install my servers with LVM over software RAID1, and grub install on the MBR of both drives. Now I have an UEFI server, and the compatibility (BIOS) mode does not seem to work.

So I went the way of installing with UEFI.

First test, single drive installation works fine.

Then I tried to install with RAID1 + LVM.
I partionned my two drives the same way:

  • an EFI system partition, 200MB
  • a physical RAID partition

Then I did setup:
– a RAID 1 using both disks RAID partitions
– a LVM volume group on the RAID 1 array
– three logical volumes: /, /home and swap

The installation went on, but on reboot, I get a grub shell and I am stuck.

So, is it possible to have grub2-efi work on LVM over RAID1 ? What is the way to achieve this ? Are there other bootloader alternatives (direct linux loading from EFI ??) ? etc…

Best Answer

Ok, I found the solution and can answer my own questions.

1) can I use LVM over RAID1 on a UEFI machine ?

Yes, definitely. And it will be able to boot even if one of the two disks fails.

2) How to do this ?

The're seem to be a bug in the installer, so just using the installer results in a failure to boot (grub shell).

Here is a working procedure:

1) manually create the following partitions on each of the two disks: - a 512MB partition with type UEFI a the beginning of the disk - a partition of type RAID after that

2) create your RAID 1 array with the two RAID partitions, then create your LVM volume group with that array, and your logical volumes (I created one for root, one for home and one for swap).

3) let the install go on, and reboot. FAILURE ! You should get a grub shell.

4) it might be possible to boot from the grub shell, but I choosed to boot from a rescue usb disk. In rescue mode, I opened a shell on my target root fs (that is the one on the root lvm logical volume).

5) get the UUID of this target root partition with 'blkid'. Note it down or take picture with your phone, you'll need it next step.

6) mount the EFI system partition ('mount /boot/efi') and edit the grub.cfg file: vi /boot/efi/EFI/ubuntu/grub.cfg Here, replace the erroneous UUID with the one you got at point 5. Save.

7) to be able to boot from the second disk, copy the EFI partition to this second disk: dd if=/dev/sda1 of=/dev/sdb1 (change sda or sdb with whatever suits your configuration).

8) Reboot. In your UEFI setting screen, set the two EFI partitions as bootable, and set a boot order.

You're done. You can test, unplug one or the other of the disks, it should work !